Closed j0k3r closed 8 years ago
Hello @j0k3r,
So, this is going to be very hard if you are not able to reproduce it :-/. What this form does? Is it the ruler editor? If yes, then do you “lint” the rule? If yes, you might open a stream at a particular time. What could it fail? A stream is a black-box/an opaque resource type. Maybe PgSQL closes the resource and when trying to close it again, it fails. This is my assumption.
Your patch makes a lot of sense. In a perfect world, it would be useless, but streams are never stable, so it makes sense.
Are you willing to do a PR yourself?
Thank you for the bug report and the constructive attitude :+1:!
This form allow user to add a custom rule :
As far as I know, the rule is parsed and validated by RulerZ, so I guess it is linted. What kind of stream does it open? Is it a physical one (like file on the file system) or a memory one?
It seems weird to me that PostgreSQL close that kind of stream. I'll submit a PR and try to configure wallabag to use my fork before validating it solve the problem
To be frank, I have no clue. PgSQL should not have nothing to do with Hoa, and the resource type is resource
so very opaque. The form is closing a stream, apparently a file, which might be linked to the Sf form.
Looks like it fix the problem:
One last question, there is no tests on Hoa\Stream? :thinking:
@j0k3r Not yet. This is under migration. I am currently working on it!
maybe I come late in the battle, but I was wondering if the difference between your own env and travis would not be in the way Travis handles connection to postgresql (by using persistent connection, pgbouncer, or something else you would not use) and that would cause a different management of the connection's resource
Maybe, but it was also tied to PHP 5.6. This bug didn't appear using PHP > 5.6
In wallabag we are using RulerZ to implement custom rule for auto-tagging.
Everything works great until few days ago (we really don't know why) when a failing test occurs in a particular environment (PHP 5.6 & PostgreSQL). It doesn't happend in any other version of PHP and any other SGBD. And we aren't able to reproduce it in our local env with the same versions :disappointed:
Here is the failing build: https://travis-ci.org/wallabag/wallabag/jobs/174123711 (and here are other builds in context: https://travis-ci.org/wallabag/wallabag/builds/174008567).
For an unknown reason, closing a stream on
__destruct
is making the build to fail.The test is checking that a particular operator isn't available (
length is this case
, see here).Here is the plain stack trace :
I've really now idea why a stream is opened when we create a form ... but it seems to fail when closing it. Did you ever encountered that issue?
I was thinking of a fix in Stream.php on line 626:
What do you think?