Composer segfault on multiple configurations

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Composer segfault on multiple configurations

Sky Diver
Hi,

Running "composer install" with the following composer.json ends up in
a segmentation fault.

---------- START -----------
{
    "require": {
        "propel/propel": "~2.0@dev"
    },
    "config": {
        "optimize-autoloader": true
    }
}
---------- END -------------

(*) Note: when "optimize-autoloader" is set to false the error doesn't occur.

Attached are the segfault core dump file (I didn't edit the stack
trace, it's empty) + cygcheck.out (with sensitive data edited out).

I tested the following cases:
- PHP 7.0.18
- PHP 7.0.19
- PHP 5.6.10.
- After rebase all
- After a reinstall (setup -> category view -> all -> reinstall)
- After a fresh cygwin 32-bit install in an empty directory (this is
the version I run with for years)
- After a fresh cygwin 64-bit install in an empty directory

My reason for thinking this is a cygwin issue is that this behavior
doesn't repeat under Ubuntu distros, both running in a VirtualBox VM
and via Bash/WSL (a.k.a.: Bash on Ubuntu on Windows).

Would love to hear of a fix/workaround for this issue.

Thanks.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

php.exe.stackdump (444 bytes) Download Attachment
cygcheck.out (96K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Richard H Lee-2
On 17/05/2017 20:17, Sky Diver wrote:

> Running "composer install" with the following composer.json ends up in
> a segmentation fault.
>
> ---------- START -----------
> {
>      "require": {
>          "propel/propel": "~2.0@dev"
>      },
>      "config": {
>          "optimize-autoloader": true
>      }
> }
> ---------- END -------------
>
> (*) Note: when "optimize-autoloader" is set to false the error doesn't occur.
I think this may be to do with the 4096 error bug.

Composer will pull in the files and run them. One of them is:
vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php

 From you project directory, try running:
php vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php

That probably will give you a segfault. I'm not sure if changing the
filesize will help, because composer probably will fetch a fresh copy of
the file.

I did provide a small patch a few weeks ago. That might help. You'd need
to recompile and install php though cygports to use it.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Sky Diver
Thanks Richard, you've hit the nail right on the head.
Running PHP on that specific file does produce the segfault.

I'm currently running composer via "Bash on Ubuntu on Windows". I may
compile PHP from cygports later but currently I need to make up for
lost time at work over this.
Any idea when your fix will get released as an official cygwin PHP package?

Thanks again.

On Wed, May 17, 2017 at 11:24 PM, Richard H Lee
<[hidden email]> wrote:

> On 17/05/2017 20:17, Sky Diver wrote:
>>
>> Running "composer install" with the following composer.json ends up in
>> a segmentation fault.
>>
>> ---------- START -----------
>> {
>>      "require": {
>>          "propel/propel": "~2.0@dev"
>>      },
>>      "config": {
>>          "optimize-autoloader": true
>>      }
>> }
>> ---------- END -------------
>>
>> (*) Note: when "optimize-autoloader" is set to false the error doesn't
>> occur.
>
> I think this may be to do with the 4096 error bug.
>
> Composer will pull in the files and run them. One of them is:
> vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php
>
> From you project directory, try running:
> php vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php
>
> That probably will give you a segfault. I'm not sure if changing the
> filesize will help, because composer probably will fetch a fresh copy of
> the file.
>
> I did provide a small patch a few weeks ago. That might help. You'd need
> to recompile and install php though cygports to use it.
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Andrey Repin
Greetings, Sky Diver!

Please don't top-post, and don't quote raw email addresses.

> On Wed, May 17, 2017 at 11:24 PM, Richard H Lee wrote:
>> On 17/05/2017 20:17, Sky Diver wrote:
>>>
>>> Running "composer install" with the following composer.json ends up in
>>> a segmentation fault.
>>>
>>> ---------- START -----------
>>> {
>>>      "require": {
>>>          "propel/propel": "~2.0@dev"
>>>      },
>>>      "config": {
>>>          "optimize-autoloader": true
>>>      }
>>> }
>>> ---------- END -------------
>>>
>>> (*) Note: when "optimize-autoloader" is set to false the error doesn't
>>> occur.
>>
>> I think this may be to do with the 4096 error bug.
>>
>> Composer will pull in the files and run them. One of them is:
>> vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php
>>
>> From you project directory, try running:
>> php vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php
>>
>> That probably will give you a segfault. I'm not sure if changing the
>> filesize will help, because composer probably will fetch a fresh copy of
>> the file.
>>
>> I did provide a small patch a few weeks ago. That might help. You'd need
>> to recompile and install php though cygports to use it.

> Thanks Richard, you've hit the nail right on the head.
> Running PHP on that specific file does produce the segfault.

> I'm currently running composer via "Bash on Ubuntu on Windows". I may
> compile PHP from cygports later but currently I need to make up for
> lost time at work over this.
> Any idea when your fix will get released as an official cygwin PHP package?

> Thanks again.

Try turning pcre.jit off, it was known to be a problem in the past.


--
With best regards,
Andrey Repin
Thursday, May 18, 2017 15:31:02

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Richard H Lee-2
On 18/05/2017 13:34, Andrey Repin wrote:
> Try turning pcre.jit off, it was known to be a problem in the past.

This is already turned off in the cygport patches.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Sky Diver
In reply to this post by Andrey Repin
On Thu, May 18, 2017 at 3:34 PM, Andrey Repin wrote:
> Please don't top-post, and don't quote raw email addresses.
Fair enough.

On Thu, May 18, 2017 at 3:59 PM, Richard H Lee wrote:
> On 18/05/2017 13:34, Andrey Repin wrote:
>>
>> Try turning pcre.jit off, it was known to be a problem in the past.
>
>
> This is already turned off in the cygport patches.

I'm not sure if Richard is referring to a released version or a
manually compiled one, but prior to posting my issue I already went
over earlier discussions regarding pcre.jit.
This is the configuration in my php.ini:
    pcre.jit=0

I assume this means it's off.

On Thu, May 18, 2017 at 3:34 PM, Andrey Repin <[hidden email]> wrote:

> Greetings, Sky Diver!
>
> Please don't top-post, and don't quote raw email addresses.
>
>> On Wed, May 17, 2017 at 11:24 PM, Richard H Lee wrote:
>>> On 17/05/2017 20:17, Sky Diver wrote:
>>>>
>>>> Running "composer install" with the following composer.json ends up in
>>>> a segmentation fault.
>>>>
>>>> ---------- START -----------
>>>> {
>>>>      "require": {
>>>>          "propel/propel": "~2.0@dev"
>>>>      },
>>>>      "config": {
>>>>          "optimize-autoloader": true
>>>>      }
>>>> }
>>>> ---------- END -------------
>>>>
>>>> (*) Note: when "optimize-autoloader" is set to false the error doesn't
>>>> occur.
>>>
>>> I think this may be to do with the 4096 error bug.
>>>
>>> Composer will pull in the files and run them. One of them is:
>>> vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php
>>>
>>> From you project directory, try running:
>>> php vendor/propel/propel/src/Propel/Runtime/DataFetcher/PDODataFetcher.php
>>>
>>> That probably will give you a segfault. I'm not sure if changing the
>>> filesize will help, because composer probably will fetch a fresh copy of
>>> the file.
>>>
>>> I did provide a small patch a few weeks ago. That might help. You'd need
>>> to recompile and install php though cygports to use it.
>
>> Thanks Richard, you've hit the nail right on the head.
>> Running PHP on that specific file does produce the segfault.
>
>> I'm currently running composer via "Bash on Ubuntu on Windows". I may
>> compile PHP from cygports later but currently I need to make up for
>> lost time at work over this.
>> Any idea when your fix will get released as an official cygwin PHP package?
>
>> Thanks again.
>
> Try turning pcre.jit off, it was known to be a problem in the past.
>
>
> --
> With best regards,
> Andrey Repin
> Thursday, May 18, 2017 15:31:02
>
> Sorry for my terrible english...
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

[ATTN: Yaakov Selkowitz / PHP maintainer] Re: Composer segfault on multiple configurations

Richard H Lee-2
In reply to this post by Sky Diver
On 18/05/2017 08:42, Sky Diver wrote:
> Any idea when your fix will get released as an official cygwin PHP
> package?

Hi Yaakov,

I can see you're really busy with package maintenance and all, but I was
wondering if you could review and merge my patch for this issue. It's
basically changing the definition of the page size in two places.


Richard


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

php-cygwin-page-size.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Richard H Lee-2
In reply to this post by Sky Diver
On 18/05/2017 08:42, Sky Diver wrote:
> I may compile php from cygports

Just in case Sky Diver or anyone else is interested in compiling php
from Cygports, here are some simple steps to do so. It's not really
difficult and most of the time it takes up is downloading the packages
and compiling php. You'll probably want to do the compilation step
during a lunch break or something.

If you just want to get a patched php running, just skip to the steps below.

But I'm also putting putting these instructions out here in case anyone
wants to do some testing. The php devs asked for confirmation that (a)
the bug exists and (b) this patch actually fixes it, before committing
the patch.

The devs ask this as they have had problems setting up a dev environment
for php. So they are unable recreate this bug or test the patch
themselves. This is why I feel any Cygwin-specific patches for php
should, for the moment be submitted to Cygwin rather than going to php.

To recreate the bug, create a 4096 bytes php file.
$ for i in $(seq 4096); do echo; done > test.php
Then execute it.
$ php test.php
This should immediately segfault. You can also test it through apache as
there are two ways this bug can occur, through the php cli and through
the apache php module. That is why the patch is against two different
points in the source. By running apache in debug mode, you can see when
the segfault occurs.
$ /usr/sbin/apachectl -X

Steps
=====

1. Install the php source from cygwin
Install php from the Cygwin installer as normal, except check the Src
checkbox as well as the Bin checkbox.

2. cd into the source directory
$ cd /usr/src/php-7.0.19-1.src

3. Copy the attachments over in that directory
- dependencies
- php-7.0.19-page-size.patch
- php-cygport-page-size.patch

5. Install the dependencies
There are 59 packages required to build php with cygport, listed in the
attachment "dependencies". You'll probably use the command line for this
rather than manually pick out the packages by hand in Cygwin's setup.
You can either use setup's command line -P option or apt-cyg.
I used apt-cyg, so for me I run:
$ xargs apt-cyg install < dependencies
It will take a while to download all these packages.

4. Patch the cygport file
$ patch < php-cygport-page-size.patch

6. Prepare the source for compilation
$ cygport php.cygport prep

7. Compile php
$ cygport php.cygport compile
Depending on your cpu, this will take a significant amount of time.

8. Install your compiled php into a staging directory
$ cygport php.cygport install

9. Copy the files over from staging into root
$ rsync -varlI php-7.0.19-1.x86_64/inst/. /

10. Rebase the dlls in cygwin
$ rebase-trigger full
Exit all Cygwin processes, command line and services.
Run Cygwin's setup to actually perform the rebase.

If you rerun "php test.php" you now should get 4096 newlines instead of
a segfault.

Should the patch miss php 7.0.20 or whatever the next version of php is
for Cygwin, you can rerun the steps and just change the path names in
steps 2 and 9. But hopefully the path will be merged in by then.





--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

php-7.0.19-page-size.patch (1K) Download Attachment
php-cygport-page-size.patch (510 bytes) Download Attachment
dependencies (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Composer segfault on multiple configurations

Sky Diver
On Mon, May 22, 2017 at 9:38 PM, Richard H Lee wrote:
> Just in case Sky Diver or anyone else is interested in compiling php from
> Cygports, here are some simple steps to do so.

Thanks Richard, I may try this at some point, but am currently
experiencing other instabilities.
For some reason, I started getting the message "Class 'Memcache' not
found" when running memcache-aware PHP code.
Since then I went back in time and installed PHP 5.5.9, PHP 5.6.20 but
the result is the same.
There's no php-memcache extension to install (on Ubuntu, for example,
that's the way to add it).
I'm pretty sure I didn't go through the "pecl install memcache"
process, and doing so now fails during compilation.

So I might end up following your steps in order to build PHP, hoping I
could enable built-in memcache support while at it (Bash on Ubuntu on
Windows, for example, has memcache and memcached included out of the
box).

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Memcache/d (Orig: Re: Composer segfault on multiple configurations)

Richard H Lee-2
On 25/05/2017 08:50, Sky Diver wrote:
> Since then I went back in time and installed PHP 5.5.9, PHP 5.6.20 but
> the result is the same.
PHP 5.5.9, PHP 5.6.2 on Cygwin?
Were they even released on Cygwin?

> So I might end up following your steps in order to build PHP, hoping I
> could enable built-in memcache support while at it (Bash on Ubuntu on
> Windows, for example, has memcache and memcached included out of the
> box).
Unfortunately, I think memcache is a separate package from php and it
would not be compiled in by cygports.

 From what I read memcache is rather unmaintained and should be
deprecated. Memcached should be used instead.
https://github.com/oerdnj/deb.sury.org/issues/186#issuecomment-186217296

Memcache can't really be compiled for php7. Memcached can be. Taking a
quick look at memcached, the memcached server compiles fine on cygwin
except for one minor printf statement. Libmemcached, which php-memcached
relies upon, requires a little bit more work (it's that whole "undefined
symbols in shared libraries" thing). You possibly may want to consider
moving your code from memcache to memcached.

For most websites memcache/d is optional. If the website detects that
memcache/d is not present during setup, it simply does not use it.
Usually people just don't use it for development and then turn it on for
production. That is unless you specifically want to run memcache/d code
on Cygwin.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: Memcache/d (Orig: Re: Composer segfault on multiple configurations)

Sky Diver
On Fri, May 26, 2017 at 12:11 AM, Richard H Lee wrote:
> On 25/05/2017 08:50, Sky Diver wrote:
> PHP 5.5.9, PHP 5.6.2 on Cygwin?
> Were they even released on Cygwin?
Sure did. Requires a bit of digging through the "cygwin time machine"
archive but they are all there.

> Unfortunately, I think memcache is a separate package from php and it would
> not be compiled in by cygports.
Due to an accident, I happened to delete my entire C:\cygwin\bin
directory a few days back when installing and re-installing various
cygwin versions.
Currently I can't get Memcache to work anymore, but I definitely had
Memcache-related code running under cygwin with no problems.

> For most websites memcache/d is optional. If the website detects that
> memcache/d is not present during setup, it simply does not use it.
I agree with that and I guess the fastest solution would be to use
Memcache (or Memcachd or apc_*()) if present or ignore if it's not.

Thank you.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: [ATTN: Yaakov Selkowitz / PHP maintainer] Re: Composer segfault on multiple configurations

Richard H Lee-2
In reply to this post by Richard H Lee-2
Yaakov,

I probably should have copied you in on the last message to get your
attention.

It's just a simple patch to fix this page size issue with php on Cygwin.
Would be grateful if you could review and possibly accept this patch, as
it has been confirmed and does affect several people.

Richard


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

php-cygwin-page-size.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ATTN: Yaakov Selkowitz / PHP maintainer] Re: Composer segfault on multiple configurations

Vince Rice
I'm sure he will tell you himself soon enough, but no you shouldn't have. Emails re packages should go to the list, not to the package maintainers directly. If you want to ping a previous message, ping the list, not the person.


> On May 30, 2017, at 11:47 AM, Richard H Lee wrote:
>
> Yaakov,
>
> I probably should have copied you in on the last message to get your attention.
>
> It's just a simple patch to fix this page size issue with php on Cygwin. Would be grateful if you could review and possibly accept this patch, as it has been confirmed and does affect several people.
>
> Richard
>


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply | Threaded
Open this post in threaded view
|

Re: [ATTN: Yaakov Selkowitz / PHP maintainer] Re: Composer segfault on multiple configurations

Vince Rice
>> On May 30, 2017, at 11:47 AM, Richard H Lee wrote:
>>
>> Yaakov,
>>
>> I probably should have copied you in on the last message to get your attention.
>>
>> It's just a simple patch to fix this page size issue with php on Cygwin. Would be grateful if you could review and possibly accept this patch, as it has been confirmed and does affect several people.

> On May 30, 2017, at 1:59 PM, Vince Rice <[hidden email]> wrote:
>
> I'm sure he will tell you himself soon enough, but no you shouldn't have. Emails re packages should go to the list, not to the package maintainers directly. If you want to ping a previous message, ping the list, not the person.

And of course I realized too late I TOFU'd… Sorry about that.
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple