You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/30 02:43:23 UTC

[GitHub] [incubator-nuttx] yamt opened a new pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

yamt opened a new pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995


   ## Summary
       tcp_close: disable send callback before sending FIN
       
       This fixes connection closing issues with CONFIG_NET_TCP_WRITE_BUFFERS.
       
       Because TCP_CLOSE is used for both of input and output for tcp_callback,
       the close callback and the send callback confuses each other as
       the following. As it effectively disposes the connection immediately,
       we end up with responding to the consequent ACK and FIN/ACK from the peer
       with RSTs.
   ```
       tcp_timer
           -> tcp_close_eventhandler
               returns TCP_CLOSE (meaning an active close)
           -> psock_send_eventhandler
               called with TCP_CLOSE from tcp_close_eventhandler, misinterpet as
               a passive close.
               -> tcp_lost_connection
                   -> tcp_shutdown_monitor
                       -> tcp_callback
                           -> tcp_close_eventhandler
                               misinterpret TCP_CLOSE from itself as
                               a passive close
   ```
   
   extracted from https://github.com/apache/incubator-nuttx/pull/3991
   
   ## Impact
   
   tcp
   
   ## Testing
   
   tested on esp32, with the rest of https://github.com/apache/incubator-nuttx/pull/3991


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871362965


   > However, I noticed that we still have the same RST issue for the passive close case.
   > In this case, the issue happens for both CONFIG_NET_TCP_WRITE_BUFFERS=y and n.
   
   i couldn't reproduce it.
   i connected to telnetd (nuttx) using telnet (netbsd) and then disconnect it with ^[ q.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871088567


   i'm going to restart jobs again.
   
   > Run docker pull docker.pkg.github.com/apache/incubator-nuttx/apache-nuttx-ci-linux
   Using default tag: latest
   Error response from daemon: Get https://docker.pkg.github.com/v2/: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
   Error: Process completed with exit code 1.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 edited a comment on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
masayuki2009 edited a comment on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871764958


   > > However, I noticed that we still have the same RST issue for the passive close case.
   > > In this case, the issue happens for both CONFIG_NET_TCP_WRITE_BUFFERS=y and n.
   > 
   > i couldn't reproduce it.
   > i connected to telnetd (nuttx) using telnet (netbsd) and then disconnect it with ^[ q.
   
   @yamt 
   Oh, really?
   I tried the same procedure with the telnet client on both Ubuntu 18.04 (x86_64) and macOS 11.4 (x86_64) and I can see the NuttX finally sends an RST/ACK packet after received ACK from the telnet client.
   <img width="1149" alt="nuttx-tcp-passive-close-20210701" src="https://user-images.githubusercontent.com/25843920/124039028-18457f00-da3d-11eb-838e-59de95e5c820.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871056415


   i restarted the ci because the error seemed unrelated to this particular PR.
   
   > Run docker pull docker.pkg.github.com/apache/incubator-nuttx/apache-nuttx-ci-linux
   Using default tag: latest
   Error response from daemon: Get https://docker.pkg.github.com/v2/: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
   Error: Process completed with exit code 1.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871325400


   @yamt 
   
   I confirmed this PR fixes the active close RST issue with spresense:rndsi_smp  + CONFIG_NET_TCP_WRITE_BUFFERS=y
   
   However, I noticed that we still have the same RST issue for the passive close case.
   In this case, the issue happens for both CONFIG_NET_TCP_WRITE_BUFFERS=y and n.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871890375


   > > > > However, I noticed that we still have the same RST issue for the passive close case.
   > > > > In this case, the issue happens for both CONFIG_NET_TCP_WRITE_BUFFERS=y and n.
   > > > 
   > > > 
   > > > i couldn't reproduce it.
   > > > i connected to telnetd (nuttx) using telnet (netbsd) and then disconnect it with ^[ q.
   > > 
   > > 
   > > @yamt
   > > Oh, really?
   > > I tried the same procedure with the telnet client on both Ubuntu 18.04 (x86_64) and macOS 11.4 (x86_64) and I can see the NuttX finally sends an RST/ACK packet after received ACK from the telnet client.
   > > <img alt="nuttx-tcp-passive-close-20210701" width="1149" src="https://user-images.githubusercontent.com/25843920/124039028-18457f00-da3d-11eb-838e-59de95e5c820.png">
   > 
   > i guess it depends on the timing.
   > as tcp_close() disposes non ESTABLISHED connection immediately, if the app close() the socket before the last ACK arrives, we respond with a RST.
   
   i implemented a fix.
   https://github.com/apache/incubator-nuttx/pull/3991
   "tcp_close: Fix a race with passive close" commit
   
   i will submit a separate PR after testing a bit more.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871764958


   > > However, I noticed that we still have the same RST issue for the passive close case.
   > > In this case, the issue happens for both CONFIG_NET_TCP_WRITE_BUFFERS=y and n.
   > 
   > i couldn't reproduce it.
   > i connected to telnetd (nuttx) using telnet (netbsd) and then disconnect it with ^[ q.
   
   @yamt 
   Oh, really?
   I tried the same procedure with the telnet client on both Ubuntu 18.04 (x86_64) and macOS 11.4 (x86_64) and I can see the NuttX finally sends an RST/ACK packet after received ACK from the telnet client.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] yamt commented on pull request #3995: fix active close for CONFIG_NET_TCP_WRITE_BUFFERS

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #3995:
URL: https://github.com/apache/incubator-nuttx/pull/3995#issuecomment-871797874


   > > > However, I noticed that we still have the same RST issue for the passive close case.
   > > > In this case, the issue happens for both CONFIG_NET_TCP_WRITE_BUFFERS=y and n.
   > > 
   > > 
   > > i couldn't reproduce it.
   > > i connected to telnetd (nuttx) using telnet (netbsd) and then disconnect it with ^[ q.
   > 
   > @yamt
   > Oh, really?
   > I tried the same procedure with the telnet client on both Ubuntu 18.04 (x86_64) and macOS 11.4 (x86_64) and I can see the NuttX finally sends an RST/ACK packet after received ACK from the telnet client.
   > <img alt="nuttx-tcp-passive-close-20210701" width="1149" src="https://user-images.githubusercontent.com/25843920/124039028-18457f00-da3d-11eb-838e-59de95e5c820.png">
   
   i guess it depends on the timing.
   as tcp_close() disposes non ESTABLISHED connection immediately, if the app close() the socket before the last ACK arrives, we respond with a RST.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org