Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spontaneous internal error: tried to reschedule a dead thread #18

Open
eko234 opened this issue Jun 2, 2021 · 3 comments
Open

spontaneous internal error: tried to reschedule a dead thread #18

eko234 opened this issue Jun 2, 2021 · 3 comments

Comments

@eko234
Copy link

eko234 commented Jun 2, 2021

Hi, I'm trying to develop a web socket service, and all seems to work well, but I constantly get these errors that say that there was an attempt to reschedule a dead thread, the context for the error is the module rfc6455/conn-api.rkt:134:14. sometimes it takes 5 minutes, other times it takes more but there doesn't seem to be any reason for it, I've tried it on windows and Linux machines, compiled with raco and interpreting the source code, it is a very weird behavior, I hope you can help me out with this.

@eko234
Copy link
Author

eko234 commented Jun 2, 2021

I also tried your echo server example and tweaked the client to listen forever and make a new connection in case the current one closes, and the same happens.

@djholtby
Copy link

I also have this issue when a client disconnects unexpectedly. Line 134 is the executor thread.

The will breaks the ws-conn's read thread when the ws-conn gets garbage collected, and the "attempted to reschedule a dead thread" error text comes from the break code in Racket.

I believe the entire executor part can be removed. The thread holds a reference to ws-conn, so it cannot be collected while the thread is running. That means it will always be trying to break a thread that's already done.

However, the issue is that using break-thread on a thread that's dead shouldn't cause Racket to crash hard. (It should be ignored entirely, I think?)

@djholtby
Copy link

djholtby commented Jul 13, 2021

The Racket team has merged a fix for the break-thread issue, but it might not make it into 8.2 [update: it made it]

Meanwhile I have submitted a pull request #20 that works around the issue. I've made the thread hold the ws-conn reference weakly so that it can be collected while still live (what appears to be the intended behaviour). Now the thread stops on its own if this reference ever becomes #f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants