On 11/27/18 6:09 AM, john wrote:
I will try and create a simplified application that exhibits the
behavior (or doesn't).
I created an application which I feel reproduces the problem. If I use
Mojo::IOLoop::Subprocess in a specfic way it causes the Websocket code
to behave erratically. I feel like I am using the framework as
intended but if not this will hopefully provide some insight into what I
am doing wrong.
What the code does:
- every few seconds execute a Subprocess
- starts a websocket listener when browser connects
Steps to reproduce:
- start the program "./notify daemon"
- Wen browser access the application the handler code immediately hits
the on finish event ("Client disconnected")
Here is the code:
https://gist.github.com/john-/ac496cc2dd1e33adff8cee6438fe6240
Thing of note:
- The "Client disconnected" messages repeat with every iteration of the
IOLoop until
- You don't need to actually do the "system(@args)" to cause the failure.
- Comment out the Subprocess->run section and things work as expected
- I am pretty sure I used ForkCall instead of Subprocess and things
behaved the same so issue is not specific to ForkCall.
John
John
On 11/27/18 12:46 AM, Stefan Adams wrote:
Is it possible that the issue you are experiencing is related to this
<https://github.com/mojolicious/mojo-pg/issues/50> and which was
assumed to be solved by this
<https://github.com/mojolicious/mojo-pg/pull/51>, and therefore
possibly a direct consequence of that commit? kraih intended to
deprecate pubsub and jberger swooped in to save the day, but it seems
that it was known to be not well tested (just my observation from the
mailing list / GitHub issues).
Are you experiencing these issues with Mojo::Pg 4.11? Seems the
answer to that would shed a lot of light on the above.
On Mon, Nov 26, 2018 at 9:38 PM john <[email protected]
<mailto:[email protected]>> wrote:
Hello,
I have controller code that subscribes to Mojo::Pg::PubSub
messages and
sends messages via Websocket based on that subscription. However, It
appears to me that the Websocket on finish is getting hit when a
Mojo::PubSub messages comes in to listen handler. Even then the
Websocket is not really closed. If I comment out the
pubsub->unlisten
more messages come in and get delivered to the client.
Yeah, I am doing something wrong. I have not distilled it down
to a
simple scenario so it could be my problem originates outside this
code.
The "output" sub is where I see this behavior:
https://github.com/john-/telem_control/blob/084347f18bdfd69ae6b32b20fc7013786ac23bce/lib/TelemControl/Controller/Main.pm#L21
Every time a message comes in the on finish for the Websocket is
hit.
Typical log pattern:
[2018-11-26 21:27:57.82505] [2976] [debug] WebSocket for details
closed
in output handler(1006)
[2018-11-26 21:27:59.07773] [2955] [debug] item to let client
know about
(pubsub): audio
This same pattern repeats for every message that comes in via pubsub.
Yes, there is probably more happening here than I am saying but
that is
what I understand at the moment.
I am using Mojolicious-8.07 and Mojo-Pg-4.12.
Thanks,
John
--
You received this message because you are subscribed to the
Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:mojolicious%[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.