Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
00:45 xinming joined 02:30 Xliff_ joined 02:33 _Xliff_ left 03:38 xinming left
Xliff_ OK, so it wasn't Curl keeping the request open. 06:13
jnthnwrthngtn: Is there anything special you need to do on the Cro side to get a request to complete or should it just automatically clean up when it reaches the end of a specific route handler? 06:14
jnthnwrthngtn Xliff_: Not sure what you mean by "complete", but the end of the route handler isn't the end of the process of producing a response. There may be middleware after that point (including the one that logs what happened), and eventually the response will be serialized (first headers, then body) 10:05
Nicholas There is always the possiblity that "I'm doing something stupid here", but I don't think that I am 10:08
I have some code which is pretty close to the WebSocket example on cro.services/#ws 10:09
if I put a LAST phaser into the ` whenever $incoming -> $message {` block
(And reload my test page with Firefox, which clearly is doing something a bit different from Chrome)
A WebSocket handler crashed: No such method 'done' for invocant of type 'Cro::WebSocket::Message'.
and I can't work out why the *invocant* is Cro::WebSocket::Message 10:10
(and not a supply)
the code in S17-supply/syntax.t looks identical: whenever $trigger -> $value {
...
LAST {
...
bugger. Confident it isn't me. If I try to reduce it to testcase without DB::Pg, then firefox now behaves the same way as Chrome. 10:46
In that, I get "Cannot write to a closed socket" from the Cro server
but my LAST block works out
11:05 Altai-man joined
Nicholas Oh well. Firefox behaves differently if you're running the server inside a docker container. 11:10
That clearly isn't helping.
11:46 lizmat_ joined 11:47 _Xliff_ joined 11:55 lizmat_ left, lizmat_ joined, lizmat left, JRaspass left, Xliff_ left 11:56 Nicholas left, lizmat_ left, lizmat joined, Nicholas joined 12:03 JRaspass joined
_Xliff_ jnthnwrthngtn: Well, it seems like a single handler has this runawayu resource issue. 12:08
And I can't seem to figure out what's causing itg.
s/itg/it/
It just seems like the request gets serve as normal, but the thread does not close properly. I thought Curl might have been holding it open with a leaked file handle, but I am closing all of those, now. 12:09
(at least I am using the close method)
Even so, after that handler is run ONE TIME, one processor is forced to 100% usage and memory usage shoots through the roof. 12:10
Looks like I will need to use the profiler on a larger machine to solve this issue. *sigh*
Any ideas on how to do that will be helpful. I've never used it, before. 12:11
jnthnwrthngtn _Xliff_: What is the response body? 12:20
But really Log::Timeline is the first resort. 12:21
Before profiling 12:22
As it may show for example that the response serializer phase never ends
_Xliff_ I
Would I need to run things via Cro to get that? 12:23
s/Cro/Comma/
jnthnwrthngtn Well, if you want the nice visualization yes.
But otherwise you can just get it to write JSON lines output and read that 12:24
_Xliff_ I'll probably need some help converting my existing source tree into a soluition for Comma.
I've been using comma for mostly small debugging tasks and Grammar development. 12:25
jnthnwrthngtn If all you need is to run it with the timeline view just 1) new project from sources, 2) create a run configuration and tell it what script to run and what parameters to pass to Raku (for example any -Ifoo)
Then Run with timeline view. That should be it. 12:26
(In order to get the visualization, anyway)
_Xliff_ Can you set up environment vars using Comma? 12:27
jnthnwrthngtn Really all it does is run Rakudo with an env var set telling Log::Timeline a port number, then connects to it.
Yes, in the run configuration dialog
That's been possible pretty much forever for running scripts (and probably for well over a year for tests too :)) 12:28
_Xliff_ Add as Cro service sor Raku app? 12:31
jnthnwrthngtn If you have a .cro.yml then as Cro service, but all it will really do is set up the env vars from that file for you 12:35
If you're not using `cro run` to run the thing then just go for Raku app
_Xliff_ It's picking up external libraries from the wrong place. 12:45
I haved a -I for my own version of Cro::WebApp, but it is using the system installed version. Even with -I in the run config.
OK, so how do I get the JSON data? I will just have to run it without comma for the time being. 12:49
jnthnwrthngtn Huh, does the command line that it actually runs look correct? 12:50
You put the -I things in Raku parameters, not script parameters? 12:51
_Xliff_ Yep. 12:52
jnthnwrthngtn Hm, so does the command it runs match what you run manually? I mean, Comma doesn't have any say in how to find modules, it's just invoking Rakudo. 12:54
Anyway, see Log::Timeline README for the environment variable to set if you want to do it that way
_Xliff_ I'd have to restart everything again, but the command looked right.
jnthnwrthngtn I'm guessing either something missed or maybe incorrect working directory, if you have relative -I paths 12:58
_Xliff_ OK. So request has been made and I only have 1 entry in log file. 13:00
Is that a good thing or does that indicate I'm still processing a request?
Yeah. K = 1 and no corresponding k=2. 13:01
So what can hang up things like this?
OK, so "Process Request" which is i:1 has a k:1 but no accompanying k:2 13:07
Same with i:2
Actually no. i:2 finishes. i:3 and i:4 do not. 13:09
jnthnwrthngtn Hm, I'm guessing IO buffering... 13:13
(there should be more in the ifle than that)
I'd expect there not only to be process request but a breakdown of the phases of request processing too 13:14
_Xliff_ Hmm.... php script hangs on POST request and doesn't do anything else until I kill the server.
jnthnwrthngtn (Feel free to paste the output somehwere so I can maybe see something in it) 13:15
_Xliff_ gist.github.com/Xliff/1b77ae9a146d...d4fd6b6719 13:19
Something is definitely hanging the server. 13:21
jnthnwrthngtn But does the POST request ever make it into the request handler? 13:23
_Xliff_ No. Not until I abort the server.
jnthnwrthngtn huh, that makes it look like the request doesn't even get parsed 13:26
_Xliff_ Yeah. I'm using DB::MySQL -- Looks like I need to call .finish on the statement handle, but seems there is some laziness involved. 13:28
jnthnwrthngtn How are you producing a response? `content ` and then what? 13:29
jnthnwrthngtn is quite confused by this point, though, as the pieces don't add up :) 13:30
_Xliff_ Welcome to my world. 13:31
OK. I need to sleep. Thanks for the help!
jnthnwrthngtn Rest well 13:32
13:45 Xliff_ joined 13:46 Xliff_ left 13:48 _Xliff_ left
lizmat so, I just realized that I have a case for letting browsers / proxies cache on request generated HTML 18:24
so it looks like "content" could also some some args describing caching baheviour 18:25
*behaviour
jnthnwrthngtn lizmat: No, you just call `cache-control` (before or after content) 18:33
Or if it should apply over many route handlers, but it in an `after-matched` block 18:34
lizmat jnthnwrthngtn++
jnthnwrthngtn See cro.services/docs/reference/cro-ht...achability 18:35
lizmat was just looking at that, how could I have missed that before :-)
jnthnwrthngtn
.oO( we have too many features :D )
18:36
Home time for me. :)
18:43 Altai-man left