View Issue Details

IDProjectCategoryView StatusLast Update
0001916XdebugUncategorizedpublic2021-01-20 11:28
ReporterMr_What4 Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status feedbackResolutionopen 
Product Version3.0.1 
Summary0001916: Seeing a Segfault with XDebug 3.0.1 and PHP 7.2 - 8.0
DescriptionWhen running PHPCS with xdebug installed and enabled is causing a segfault:

Starting program: /usr/lib64/php7.4/bin/php -f vendor/bin/phpcs -- -s --standard=phpcs.xml
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[Detaching after vfork from child process 28607]
[Detaching after vfork from child process 28609]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4c9b390 in ?? ()
(gdb) bt
#0 0x00007ffff4c9b390 in ?? ()
#1 0x0000555555921e7e in tsrm_shutdown () at /var/tmp/portage/dev-lang/php-7.4.13/work/sapis-build/cli/TSRM/TSRM.c:215
0000002 0x00005555556b5f41 in main (argc=6, argv=0x55555658a100) at /var/tmp/portage/dev-lang/php-7.4.13/work/sapis-build/cli/sapi/cli/php_cli.c:1380

This only seems to happen with XDebug 3.0.1, 2.9.8 seems to work as expected.

Steps To Reproduce/usr/lib64/php7.4/bin/php -f vendor/bin/phpcs -- -s --standard=phpcs.xml
Additional InformationPHP version doesn't seem to matter, 7.4.13 was used for this backtrace.

squizlabs/php_codesniffer 3.5.8 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.


My xdebug.ini:

zend_extension=/usr/lib64/php7.4/lib/extensions/no-debug-zts-20190902/xdebug.so
;xdebug.auto_trace = 0
;xdebug.cli_color = 0
;xdebug.collect_assignments = 0
;xdebug.collect_includes = 1
;xdebug.collect_params = 0
;xdebug.collect_return = 0
;xdebug.collect_vars = 0
;xdebug.coverage_enable = 1
xdebug.default_enable = 0
;xdebug.dump.* = Empty
;xdebug.dump_globals = 1
;xdebug.dump_once = 1
;xdebug.dump_undefined = 0
;xdebug.extended_info = 1
;xdebug.file_link_format =
;xdebug.force_display_errors = 0
;xdebug.force_error_reporting = 0
;xdebug.halt_level = 0
;xdebug.idekey = *complex*
;xdebug.manual_url = http://www.php.net
;xdebug.max_nesting_level = 256
;xdebug.max_stack_frames = -1
;xdebug.overload_var_dump = 2
;xdebug.profiler_aggregate = 0
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 0
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_enable_trigger_value = ""
;xdebug.profiler_output_dir = /tmp
;xdebug.profiler_output_name = cachegrind.out.%p
;xdebug.remote_addr_header = ""
;xdebug.remote_autostart = 0
;xdebug.remote_connect_back = 0
;xdebug.remote_cookie_expire_time = 3600
;xdebug.remote_enable = 0
;xdebug.remote_handler = dbgp
;xdebug.remote_host = localhost
;xdebug.remote_log =
;xdebug.remote_mode = req
;xdebug.remote_port = 9000
;xdebug.scream = 0
;xdebug.show_error_trace = 0
;xdebug.show_exception_trace = 0
;xdebug.show_local_vars = 0
;xdebug.show_mem_delta = 0
;xdebug.trace_enable_trigger = 0
;xdebug.trace_enable_trigger_value = ""
;xdebug.trace_format = 0
;xdebug.trace_options = 0
;xdebug.trace_output_dir = /tmp
;xdebug.trace_output_name = trace.%c
;xdebug.var_display_max_children = 128
;xdebug.var_display_max_data = 512
;xdebug.var_display_max_depth = 3

My phpcs.xml:

<?xml version="1.0"?>
<ruleset name="FaaPz PDO">
    <description>Just another PDO database library</description>

    <file>src/</file>
    <file>tests/</file>

    <!-- Include the whole PSR-1 standard -->
    <rule ref="PSR1"/>

    <!-- Include the whole PSR-2 standard -->
    <rule ref="PSR2"/>

    <!-- Include the whole PSR-12 standard -->
    <rule ref="PSR12"/>

    <!-- Include part of the Squiz standard -->
    <rule ref="Squiz">
        <exclude name="Generic.Commenting.DocComment.ContentAfterClose"/>
        <exclude name="Generic.Commenting.DocComment.ContentAfterOpen"/>
        <exclude name="Generic.Commenting.DocComment.ContentBeforeClose"/>
        <exclude name="Generic.Commenting.DocComment.MissingShort"/>
        <exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
        <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
        <exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
        <exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
        <exclude name="Squiz.Commenting.ClassComment.Missing"/>
        <exclude name="Squiz.Commenting.ClassComment.TagNotAllowed"/>
        <exclude name="Squiz.Commenting.ClosingDeclarationComment.Missing"/>
        <exclude name="Squiz.Commenting.FileComment.MissingAuthorTag"/>
        <exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
        <exclude name="Squiz.Commenting.FileComment.MissingSubpackageTag"/>
        <exclude name="Squiz.Commenting.FileComment.PackageTagOrder"/>
        <exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen"/>
        <exclude name="Squiz.Commenting.FileComment.SubpackageTagOrder"/>
        <exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
        <exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
        <exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
        <exclude name="Squiz.Commenting.FunctionComment.Missing"/>
        <exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
        <exclude name="Squiz.Commenting.LongConditionClosingComment.Missing"/>
        <exclude name="Squiz.Commenting.VariableComment.IncorrectVarType"/>
        <exclude name="Squiz.ControlStructures.ElseIfDeclaration.NotAllowed"/>
        <exclude name="Squiz.ControlStructures.SwitchDeclaration.BreakIndent"/>
        <exclude name="Squiz.ControlStructures.SwitchDeclaration.DefaultNoBreak"/>
        <exclude name="Squiz.Files.FileExtension.ClassFound"/>
        <exclude name="Squiz.Formatting.OperatorBracket.MissingBrackets"/>
        <exclude name="Squiz.Objects.ObjectInstantiation.NotAssigned"/>
        <exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue"/>
        <exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed"/>
        <exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure"/>
        <exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound"/>
        <exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
        <exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose"/>
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.After"/>
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.AfterLast"/>
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
        <exclude name="Squiz.WhiteSpace.FunctionSpacing.BeforeFirst"/>
        <exclude name="Squiz.WhiteSpace.MemberVarSpacing.FirstIncorrect"/>
        <exclude name="Squiz.WhiteSpace.ObjectOperatorSpacing.Before"/>
    </rule>
</ruleset>
TagsNo tags attached.
Operating System
PHP Version7.4.10-7.4.19

Activities

Mr_What4

2020-12-16 00:51

reporter   ~0005590

I put in the xdebug.ini from 2.9, here is my 3.0.1:

zend_extension=/usr/lib64/php7.4/lib/extensions/no-debug-zts-20190902/xdebug.so
;xdebug.cli_color = 0
;xdebug.client_discovery_header =
;xdebug.client_host = localhost
;xdebug.client_port = 9003
;xdebug.collect_params = 0
;xdebug.collect_return = 0
;xdebug.connect_timeout_ms = 200
;xdebug.discover_client_host = 0
;xdebug.dump.* = Empty
;xdebug.dump_globals = 1
;xdebug.dump_once = 1
;xdebug.dump_undefined = 0
;xdebug.file_link_format =
;xdebug.filename_format = ...%s%n
;xdebug.force_display_errors = 0
;xdebug.force_error_reporting = 0
;xdebug.gc_stats_output_name = gcstats.%p
;xdebug.halt_level = 0
;xdebug.idekey = *complex*
;xdebug.log =
;xdebug.log_level = 7
;xdebug.max_nesting_level = 256
;xdebug.max_stack_frames = -1
xdebug.mode=off
;xdebug.output_dir = /tmp
;xdebug.profiler_append = 0
;xdebug.profiler_output_name = cachegrind.out.%p
;xdebug.scream = 0
;xdebug.show_error_trace = 0
;xdebug.show_exception_trace = 0
;xdebug.show_local_vars = 0
;xdebug.start_upon_error = default
;xdebug.start_with_request = default
;xdebug.trace_format = 0
;xdebug.trace_options = 0
;xdebug.trace_output_dir = /tmp
;xdebug.trace_output_name = trace.%c
;xdebug.trigger_value = ""
;xdebug.var_display_max_children = 128
;xdebug.var_display_max_data = 512
;xdebug.var_display_max_depth = 3

derick

2020-12-17 15:00

administrator   ~0005591

Can you provide the exact steps (git clone, composer install, etc) for me to try to reproduce this problem?

Mr_What4

2020-12-17 15:55

reporter   ~0005593

Hi Derick,

Thanks for taking a look at this. I am using gentoo AMD Ryzen 7 3700X 8-Core Processor, cflags = "-march=native -mtune=native -O2 -ftree-vectorize -fomit-frame-pointer -ggdb -pipe". Composer version: 1.10.15

The following produces two segfaults. First segfault happens on composer install and the second on phpcs. Seems to happen every time for me.

git clone git@github.com:FaaPz/PDO.git
composer install
vendor/bin/phpcs -s --standard=phpcs.xml

Mr_What4

2021-01-19 02:59

reporter   ~0005639

Problem still persists with xdebug 3.0.2

derick

2021-01-20 11:28

administrator   ~0005641

I have tried reproducing this (with xdebug 3.0.3-dev), but I am not getting any segfault, or any other warnings when running with valgrind like this either:

<code>
USE_ZEND_ALLOC=0 valgrind php -f vendor/bin/phpcs -- -s --standard=phpcs.xml
</code>

Your original backtrace doesn't show that Xdebug is involved in the crash either... So unless you can come up with something that allows me to see the problem locally, I am not sure what I can do.

Issue History

Date Modified Username Field Change
2020-12-16 00:40 Mr_What4 New Issue
2020-12-16 00:51 Mr_What4 Note Added: 0005590
2020-12-17 15:00 derick Assigned To => derick
2020-12-17 15:00 derick Status new => feedback
2020-12-17 15:00 derick Note Added: 0005591
2020-12-17 15:55 Mr_What4 Note Added: 0005593
2020-12-17 15:55 Mr_What4 Status feedback => assigned
2021-01-19 02:59 Mr_What4 Note Added: 0005639
2021-01-20 11:28 derick Status assigned => feedback
2021-01-20 11:28 derick Note Added: 0005641