Closed leto closed 7 years ago
i do cut some corners when using AnyEvent, so i have some guesses on what happened. need time to investigate.
would you please provide output of:
perl -MJSON::XS -wle 'print $JSON::XS::VERSION'
perl -MJSON::PP -wle 'print $JSON::PP::VERSION'
thanks in advance!
It looks like I don't have JSON::XS installed on this machine and
$ perl -MJSON::PP -wle 'print $JSON::PP::VERSION'
2.27400
Let me know if you need anything else.
some intermediate results: i believe it's a bug in AnyEvent::Handle/JSON::PP interrogation.
in line 1763 of AnyEvent::Handle
$json->incr_skip;
is not enough to reset broken state of json parser.
it only happens when the pool sends something strange, and it's not related to how many instances of script run simultaneously.
i guess i need to make a testcase and fill a bug to AnyEvent maintainer. and in the meanwhile figure out how to avoid triggering of this.
I can tell you that this doesn't seem to ever happen when I only run 1 server.pl
in a directory. But if I do cp server.pl server2.pl
and you run both, logging to different log files, but both sharing lib/
, this seems to happen after about a day, under light use. Perhaps this bug exists with only one server, but the race condition doesn't happen nearly often enough, not sure.
This is not blocking me currently, I am going to see if JSON::XS
changes anything and I will add any more details that I find to this issue.
Also, latest AnyEvent is 7.14, maybe there is something related to this in recent version.
That's strange. It should not affect in this way.
Yep, checked 7.14, does not seem to fix this.
Well, I have my own event lib and json too, I just wanted to use standard modules. Can not promise dates, but will try to fix this asap.
If you want, please try to fix that line 1763 of AnyEvent::Handle like this:
$json->incr_skip; $json->{incr_parsing} = 0;
it's opportunistic fix, hopeful workaround of this problem.
i close this issue, do not hesitate to open it again or open new ones for any problems.
This bug is kind of fun:
This happens when server1.pl and server2.pl share the same
lib/
directory. It does not happen for a long time, which leads me to believe it is a race condition that is not tickled easily.I understand if your response is "don't do that" but I figured I should tell you.
Linux 4.9.36-x86_64-linode85 #1 SMP Thu Jul 6 15:31:23 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux