apache / apache/nuttx

CONFIG_NET_TCP_WRITE_BUFFERS=y lead to deadlock

Open
#5,973 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

Recently I've been testing FTPD operation on custom SAME70 based board with FileZilla FTP client.
I had `CONFIG_NET_TCP_WRITE_BUFFERS=y`.

I have a folder with 2 files that I try to upload from laptop to device. Upload of a folder fails.

FileZilla starts 2 FTP sessions in parallel one for each file upload so 2 instances of `ftpd_worker` are started.
The situation happens in 80% of my tests. The FTP client send `"STOR"` command for both files and by adding extra logs I see that both threads reach `ftpd.c:1908` code `ret = ftpd_response(session->cmd.sd, session->txtimeout, g_respfmt1, 150, ' ', "Opening data connection");` at the same time so `send` is called concurrently.

The logs before `ftpd_response` call are printed, but there are no logs after `ftpd_response` call. NSH "ps" shows that both threads are "waiting for semaphore", but most probably loop somewhere inside the `psock_tcp_send` trying to allocate `iob`.

Setting `CONFIG_NET_TCP_WRITE_BUFFERS=n` solves the issue and FTP server operates as expected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.