You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The killed FTP upload triggers an RST which then leads to kTCP panic and then wedge. Note that on FDD images the timeout must be tuned down so that ftp upload writes ~50KB and does not fill the floppy and causes another bug.
Additional information
The vibe-coded fix is at duzenko@38bd6f4.
To review/understand it would strictly require a person with the kernel/kTCP communication knowledge, who I'm not regretfully.
It probably does something wrong/stupid, but still fixes the symptom and thus demonstrates the problem.
Note: I can still reproduce another wedge on a PM build in VBox with faster PCnet card, but QEMU is pretty stable with the fix.
I'm trying to reproduce this on QEMU: I'm running macOS and it doesn't have timeout, so I'm trying to think of a way to force a RST to be transmitted. Any other ideas?
Using the following shell script instead of timeout on macOS, and also just running curl and typing ^C to kill the connection (both which should send an RST?) and everything is normal on the ELKS/QEMU side, no errors and keeps working multiple times. That is, I can't yet get this to repeat. I added some debug code checking for RST received in ktcp in ESTABLISHED and SYNRECV states and apparently no RST is being sent by macOS on curl's forced TCP connection termination, it seems?
# Run command in the background
bash -c "yes | curl -s --max-time 5 -T - 'ftp://localhost:2121//file' -u root:" &
# Get the process ID
PID=$!
# Sleep for 1 second, then kill the process if it is still running
(sleep 1 && kill -HUP $PID) 2>/dev/null & watchers_pid=$!
# Wait for the main command to finish
wait $PID 2>/dev/null
I have more carefully reviewed your proposed fix, can you prepare a PR for it? Perhaps others can duplicate this on Linux. I would still like to be able to have some replication of the problem before committing a fix.
Are you running your QEMU with vt-x on? Or software emulation?
My AI says that your kill does not apply to curl itself and suggests to test with one of these
# faithful to the original — Homebrew coreutils, signals the whole process group
gtimeout 1 bash -c "yes | curl -s --max-time 5 -T - 'ftp://localhost:2121/file' -u root:"
# no install: drop the wrapper so $! is curl itself, and use a signal it can't catch
yes | curl -s --max-time 5 -T - 'ftp://localhost:2121/file' -u root: &
sleep 1
kill -9 $!
I'm seeing the un-reaped child of ftpd, is that what you're seeing? I will look into that, should be waited on by ftpd, but does correct itself after a couple commands.
Still not able to reproduce even with your suggestions. #2801 showed the same hang (caused by ktcp not returning a failure code, just like your AI found) but reproducible under some additional circumstances. I'm going to continue to try to put together a test harness to reproduce - both issues are definitely a bug and need fixing. I will keep you posted, thanks!
I have reviewed both @duzenko's code here as well as the many fixes in #2801. Both contain a similar but not identical fix for the reported ktcp hang/deadlock problem, which I know fully understand. @duzenko's code also contains three additional fixes which need to be handled.
I have created a list of all these and #2801's issues and will be submitting PRs to fix each of them as I am able to reproduce them. @duzenko, no need to produce a PR at this point, lets keep this open until these are fixed which I hope to get done soon. Thank you.
@duzenko, #2809 should fix most all the issues you have run into here. Most of that PR consists of your vibe-coded proposal with a few mods, but I've also added a number of other fixes as well, as I'm back deep diving into the ktcp and kernel networking code. I'm still working on enhancements for better usage of ktcp's limited heap, so that SBRK FAIL messages can also be curtailed.
Please test when you have a minute and let me know the results, thanks!
Activity
ghaerr commentedon Aug 5, 2026
Hello @duzenko,
Geez, sorry, I completely missed seeing this. I'll take a look and report back, thanks!
ghaerr commentedon Aug 5, 2026
I'm trying to reproduce this on QEMU: I'm running macOS and it doesn't have
timeout, so I'm trying to think of a way to force a RST to be transmitted. Any other ideas?I've reviewed the fix, and I think it looks pretty good, but want to play with it a bit when I can get a RST to reproduce the bug.
Does
ftpdnot return an error when it runs out of space? I can look into that also.ghaerr commentedon Aug 6, 2026
@duzenko,
Using the following shell script instead of
timeouton macOS, and also just running curl and typing ^C to kill the connection (both which should send an RST?) and everything is normal on the ELKS/QEMU side, no errors and keeps working multiple times. That is, I can't yet get this to repeat. I added some debug code checking for RST received in ktcp in ESTABLISHED and SYNRECV states and apparently no RST is being sent by macOS on curl's forced TCP connection termination, it seems?I have more carefully reviewed your proposed fix, can you prepare a PR for it? Perhaps others can duplicate this on Linux. I would still like to be able to have some replication of the problem before committing a fix.
Thank you!
duzenko commentedon Aug 7, 2026
Are you running your QEMU with vt-x on? Or software emulation?
My AI says that your kill does not apply to curl itself and suggests to test with one of these
Or how about docker linux container?
duzenko commentedon Aug 7, 2026
BTW do you run ps in elks after each curl run?
Your repro seems to wedge it too, after maybe 10th run. Mine typically after 1-2.
ghaerr commentedon Aug 8, 2026
I'm seeing the un-reaped child of ftpd, is that what you're seeing? I will look into that, should be waited on by ftpd, but does correct itself after a couple commands.
Still not able to reproduce even with your suggestions. #2801 showed the same hang (caused by ktcp not returning a failure code, just like your AI found) but reproducible under some additional circumstances. I'm going to continue to try to put together a test harness to reproduce - both issues are definitely a bug and need fixing. I will keep you posted, thanks!
ghaerr commentedon Aug 9, 2026
I have reviewed both @duzenko's code here as well as the many fixes in #2801. Both contain a similar but not identical fix for the reported ktcp hang/deadlock problem, which I know fully understand. @duzenko's code also contains three additional fixes which need to be handled.
I have created a list of all these and #2801's issues and will be submitting PRs to fix each of them as I am able to reproduce them.
@duzenko, no need to produce a PR at this point, lets keep this open until these are fixed which I hope to get done soon. Thank you.
ghaerr commentedon Aug 11, 2026
@duzenko, #2809 should fix most all the issues you have run into here. Most of that PR consists of your vibe-coded proposal with a few mods, but I've also added a number of other fixes as well, as I'm back deep diving into the ktcp and kernel networking code. I'm still working on enhancements for better usage of ktcp's limited heap, so that SBRK FAIL messages can also be curtailed.
Please test when you have a minute and let me know the results, thanks!