
@pankajdoharey has joined the channel

[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.

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?

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

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.

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

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?

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.

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

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!

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?

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.

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.)

Ok great

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

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.

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)

Oh, very good idea! Thank you, Brian!

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

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

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

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

What sort of alternative are you looking for?

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.

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

@markusreynolds1989 has joined the channel

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

Because it does this

Using other-doc
with #:indirect <content>
would probably be better than link
.

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.

I’ll try that thanks.

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

@saihemanth has joined the channel