pankajdoharey
2020-10-8 07:48:23

@pankajdoharey has joined the channel


anything
2020-10-8 13:42:52

[For background on this, look up this thread.] I think there is definitely a problem there and it might not be in my code. That stack trace that you said was a known problem seems to have gone away with upgrading, but there is a new one that’s seems associated with the problem. The stack trace is this:

port->ssl-ports: accept failed (input terminated prematurely) context...: /usr/share/racket/collects/openssl/mzssl.rkt:1544:8: loop /usr/share/racket/collects/openssl/mzssl.rkt:1520:0: wrap-ports /usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:555:3 ...higher-order.rkt:375:33 /usr/share/racket/pkgs/web-server-lib/web-server/private/dispatch-server-with-connect-unit.rkt:87:0: handle-connection/cm27

When this shows up in the log, the server spins the CPU to 100%. (I’m convinced of that now because I just restarted it and this time it very quickly reproduced the problem and I saw this stack trace in the log. This log below is essentially the messages I print to the stdout.)

%cat run.log TCP port 1116 set. Now serving at port 1116… get-connection: using database ./the-database.db. get-connection: using database ./the-database.db. get-connection: using database ./the-database.db. port->ssl-ports: accept failed (input terminated prematurely) context…: /usr/share/racket/collects/openssl/mzssl.rkt:1544:8: loop /usr/share/racket/collects/openssl/mzssl.rkt:1520:0: wrap-ports /usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:555:3 …higher-order.rkt:375:33 /usr/share/racket/pkgs/web-server-lib/web-server/private/dispatch-server-with-connect-unit.rkt:87:0: handle-connection/cm27 get-connection: using database ./the-database.db. %racket Welcome to Racket v7.8. > ^D %

I’ve been keeping a separate instance of the server running at port 9999. Nobody visits it. It hasn’t reproduced the problem over a week.


samth
2020-10-8 13:50:36

That does sound like a bug somewhere. If you kill the racket process when it’s using 100% cpu, do you get a stack trace?


anything
2020-10-8 13:51:06

I do not. Let me try that right now and see.


anything
2020-10-8 13:52:21

I can’t try this right now because the server is not spinning 100% right now. But I have tried that before and the answer then was “no”. Nothing was written to the logs when the server was killed.


anything
2020-10-8 13:53:22

After I posted my stack trace above (the server has been restarted a moment ago), I see two new interesting stack traces in the log:

get-connection: using database ./the-database.db. tcp-read: error reading system error: Connection timed out; errno=110 context...: /usr/share/racket/collects/openssl/mzssl.rkt:1065:0: pump-input-once /usr/share/racket/collects/openssl/mzssl.rkt:1237:2: loop /usr/share/racket/collects/openssl/mzssl.rkt:1287:9: do-write /usr/share/racket/collects/openssl/mzssl.rkt:1391:7 /usr/share/racket/pkgs/web-server-lib/web-server/http/response-structs.rkt:28:12 /usr/share/racket/pkgs/web-server-lib/web-server/http/response.rkt:146:0: output-response-body /usr/share/racket/pkgs/web-server-lib/web-server/http/response.rkt:33:4 /usr/share/racket/collects/racket/private/more-scheme.rkt:163:2: select-handler/no-breaks /usr/share/racket/pkgs/web-server-lib/web-server/private/dispatch-server-with-connect-unit.rkt:104:4: connection-loop tcp-write: error writing system error: Connection timed out; errno=110 context...: /usr/share/racket/collects/openssl/mzssl.rkt:1088:0: pump-output-once /usr/share/racket/collects/openssl/mzssl.rkt:1237:2: loop /usr/share/racket/collects/openssl/mzssl.rkt:1287:9: do-write /usr/share/racket/collects/openssl/mzssl.rkt:1391:7 /usr/share/racket/pkgs/web-server-lib/web-server/http/response-structs.rkt:28:12 /usr/share/racket/pkgs/web-server-lib/web-server/http/response.rkt:146:0: output-response-body /usr/share/racket/pkgs/web-server-lib/web-server/http/response.rkt:33:4 /usr/share/racket/collects/racket/private/more-scheme.rkt:163:2: select-handler/no-breaks /usr/share/racket/pkgs/web-server-lib/web-server/private/dispatch-server-with-connect-unit.rkt:104:4: connection-loop


samth
2020-10-8 13:55:09

It looks like something is going wrong at the SSL level, but it’s hard to know exactly what. Do you have a way that other people could reproduce this?


anything
2020-10-8 14:00:35

I don’t have a precise way to reproduce the problem. But if anyone would like to take a look, I can prepare a shell account with the server running. I can also prepare a package with the entire code. (It’s almost the simplest web server we can get.) But before that, maybe I should try to simulate the problem by writing an HTTP client that randomly tries to connect to the server and abort its connection in the middle of the way to see if I can reproduce this port->ssl-ports problem. That’d give me a precise-enough way to reproduce the problem. Feel free to suggest anything.


samth
2020-10-8 14:01:42

A package with the code would be the most helpful thing, I think. Along with whatever you do to provoke the issue.


anything
2020-10-8 14:04:38

Alright. I’ll prepare a package first for public scrutiny. Meanwhile I will try to find a method to provoke the issue. More soon. Thanks very much!


ryanc
2020-10-8 14:12:04

The package server appears to have a bug in the registration process. When I enter an email address and click “Email me a code” I get a page with an error from string->jsexpr and a byte string containing HTML. @jeapostrophe?


anything
2020-10-8 15:21:50

Package with the server: https://filebin.net/e4a5xjf9es4a9eo9

To run it, just tell run.sh to your shell. No root needed. Here’s the README file included in the package:

> To run the server, just execute run.sh. No root needed. The server > begins at srv.rkt. There are only two GET requests possible: either > /programs or /stats. > > —8<—————cut here—————start————->8— > (define-values (dispatch url) > (dispatch-rules > ((“programs”) programs->response) > ((“stats”) stats->response))) > > (define (programs->response r) > (string->response (model:cache-get))) > —8<—————cut here—————end—————>8— > > Here’s cache-get: > > —8<—————cut here—————start————->8— > (define (cache-get) > (define sql “select data from cache”) > (hash-ref (first (sql-fetch sql)) ’data)) > —8<—————cut here—————end—————>8— > > That’s it. This is the web server.


anything
2020-10-8 15:23:10

I guess I can upload the file through over here. Here you go. (My next step is to try to provoke the issue with a method, which I don’t have currently.)


samth
2020-10-8 15:23:27

Ok great


samth
2020-10-8 16:00:01

I can run the server successfully, so if you have a suggestion about how to get it to fail I’ll try that


anything
2020-10-8 16:02:28

Thanks! I don’t know yet how to reproduce the problem. Regular browser visits do not produce the problem. Sometimes it takes a week to produce the problem and today I got the problem minutes after starting it out — in production.


badkins
2020-10-8 16:47:10

If there’s a bug, we definitely want it fixed, but as a workaround, one option is to put a web server, like nginx, in front of your app, and have nginx handle the SSL (assuming the problem is with SSL handling)


anything
2020-10-8 17:06:06

Oh, very good idea! Thank you, Brian!


samdphillips
2020-10-8 18:11:31

Is there an alternative to @other-doc to link to another packages documentation?


samdphillips
2020-10-8 18:11:57

I mean in the public documentation, locally it works fine.


badkins
2020-10-8 18:29:07

If you haven’t done that before, let me know if you need help with the config.


anything
2020-10-8 18:30:49

Thanks! I haven’t done it before, but I’ll probably make it. Thanks for your kind attention!


samth
2020-10-8 18:46:35

What sort of alternative are you looking for?


badkins
2020-10-8 18:57:14

This might help: upstream racket { least_conn; server localhost:5301; # Change ports as needed server localhost:5302; } server { server_name <http://example.com\|example.com>; root /home/deploy/example/web/public; try_files $uri/index.html $uri.html $uri @racket; location @racket { proxy_pass <http://racket>; } } If you only have one Racket process, delete the server localhost:5302 line. The SSL setup is pretty straightforward from the nginx docs.


samdphillips
2020-10-8 19:25:52

Just link to another package’s documentation. I mean I could just use @link if there isn’t a more preferred form.


markusreynolds1989
2020-10-8 21:22:05

@markusreynolds1989 has joined the channel


sorawee
2020-10-8 21:36:54

I mean, why don’t you prefer other-doc?


samdphillips
2020-10-8 21:53:28

Because it does this


mflatt
2020-10-8 22:22:51

Using other-doc with #:indirect &lt;content&gt; would probably be better than link.


anything
2020-10-8 23:18:58

Nice. I’m sure it will help. I haven’t had a chance to try it yet, but I will very soon. Perhaps tomorrow. Thanks very much. I’ll report back.


samdphillips
2020-10-8 23:43:53

I’ll try that thanks.


mbk.alc
2020-10-9 01:27:52

I just joined the users mailing list. Does anyone know why I wouldn’t have permission to post in google groups?


saihemanth
2020-10-9 03:36:52

@saihemanth has joined the channel