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

TCP/client-mode: disconnect #2065

Closed
zephyrbot opened this issue Jul 4, 2016 · 35 comments
Closed

TCP/client-mode: disconnect #2065

zephyrbot opened this issue Jul 4, 2016 · 35 comments
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Milestone

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jul 4, 2016

Reported by Flavio Santes:

In order to close a connection with a server, the client must:

  • set the UPI_CLOSE flag
  • send something to the server

This should be seen as a design failure, because some high-level protocols consider unwanted data as errors.

Furthermore, the high-level network API must provide a mechanism to close a connection in an easy way.

(Imported from Jira ZEP-522)

@zephyrbot
Copy link
Collaborator Author

by Sharron LIU:

Andrei, can you update status on this? It's highest priority issue.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Jul 25, 2016

by Ravi kumar Veeramally:

Exchanged information thru mail from Flavio.

The reported issue refers to the IP stack ignoring the CLOSE flag. So, if a patch is submitted such that the CLOSE flag is processed by the stack, I am sure that everything will be fine.

Furthermore, the GH-2065 is also related to the way the stack is implemented. It does not make sense that if a Zephyr app wants to connect or disconnect it must send "something", I mean, a payload. So, IMHO that behaviour must be avoided, because it is based on a very limited use-case that blocks our work.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 3, 2016

by Ravi kumar Veeramally:

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 3, 2016

by Ravi kumar Veeramally:

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Hi Flavio,

Please find attached wireshark [^tcp-conn-close.pcapng] log, and also changes in echo_server application. [^tcp-bug.patch] .

We have net tools in https://gerrit.zephyrproject.org/r/#/admin/projects/net-tools.

I tried echo-server running in qemu and echo-client on linux host. Attached sample tcp log from wireshark. It shows that core stack handles close connection properly.

Please try this.
Patch which I attached is only changes in sample test, nothing in core stack.

  1. Apply the patch.
  2. goto net tools and run ./loop-socat.sh
    and sudo ./loop-slip.sh
  3. run echo-server with 'make qemu'
  4. run echo-client from net tools
    sudo ./echo-client 2001:db8::2 -t

Let me know your findings.

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

Before to do any test from my side, I kindly ask you to test this patch in real hardware (Galileo). Once you verify your solution we can close this.

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

Could you submit your solution in Gerrit?

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

Last comment, could you run your tests in IPv4?

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Ok, I will try with Galileo and IPv4.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 4, 2016

by Ravi kumar Veeramally:

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Attached Ipv4 pcap log [^tcp-conn-close-ipv4.pcapng] . I haven't verified on Galileo, I will try that next.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 4, 2016

by Ravi kumar Veeramally:

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Attached Galileo log. [^tcp-conn-close-ipv4-galileo.pcapng]

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

Ravi kumar Veeramally I appreciate your help, but if you have a patch for this issue please submit it trough Gerrit.

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Flavio, I don't have any core IP stack related patch. Patch which I attached here is few changes in application to test different environments( like, based on network switch subnet defining src IP address according to it.). But anyway I will send attached patch to gerrit.

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

https://gerrit.zephyrproject.org/r/#/c/3935/
https://gerrit.zephyrproject.org/r/#/c/3936/

Submitted patches related to sample changes, this will help to run samples properly. No changes in core IP stack.

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

Hello Ravi, please document your findings, the ones you comment in gerrit. This is important for all the engineers developing network applications.

Even so, I do not see how this will fix the current issue (if any). Could you please share with me the line of code that handles the disconnect in client mode? If there is no mechanism for that task, please specify it.

Regards

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

As per the bug description core IP stack doesn't handle TCP disconnect. I tried with possible different scenarios TCP/IPv6|IPv4 between qemu and in Galileo. I provided the pcap logs. Connect, data exchange and disconnect seems fine in all scenarios.

Patches are not related to this issue at all, samples in zephyr/sample/net are provided for few scenarios. When I tried to check TCP in IPv6 and IPv4 in qemu and galileo, I noticed that it requires few changes in samples. That's it.

https://gerrit.zephyrproject.org/r/#/c/3935/ is about proper usage of NET_TESTING_USE_RFC3849_ADDRESSES define and https://gerrit.zephyrproject.org/r/#/c/3936 is about Rx buffers (depends on network environment, we have to allocate minimum number of Rx/tx buffers).
That is the reason I didn't specify Jira id in git commit.

So if you find some issue, please provide samples, logs and steps to reproduce the scenario. I tried possible scenarios based on "Core stack doesn't handle TCP disconnect".

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

The original description and the extended one that I sent to you describe something not yet solved.

If you have sample code that handles this situation with the high-level API please share it. Otherwise, if this functionality is handled internally by the current API, please specify that.

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Can you provide your samples or test and logs where the issue is. Steps to reproduce the issue.

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

The sample code I am using can be found at: samples/net/echo_client and echo_server.

You say there is no issue, so I must assume, everything is fine, right?.

However, do you know how to handle this situation with the high-level API?. Where is the sample code that shows how you, the maintainers, use the API?

As you may be aware, 1.5 and perhaps 1.6 will use the "old IP stack", so I am not the only one interested in sample code that works.

Regards.

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

Looks like my message is not clear. I didn't say there is no issue. I said, I tried few possibilities which I could. In those trials I didn't see the issue which you described. So I am asking you to provide scenario and steps, if possible logs will be helpful.

And the rest "high-level API and sample code using API", I don't understand your concern (how does core stack doesn't handle close flag related to High-level API).

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 11, 2016

by Flavio Santes:

I apologize if I was not clear enough. Given your feedback and after discussing this issue with my team. I think it is better to keep this issue closed. I will open other Jiras trying to only focus on one issue:

What do you think?

@zephyrbot
Copy link
Collaborator Author

by Ravi kumar Veeramally:

ok.

I will try/investigate 632 and let you know.

@zephyrbot
Copy link
Collaborator Author

by Sharron LIU:

Please reporter verify this.

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

We are still working on this. So far, it could not be verified at all.

@zephyrbot
Copy link
Collaborator Author

by Mark Linkmeyer:

Flavio Santes , if this isn't fixed correctly, I think it's appropriate to move it to the Reopened state and then back into the Accepted state so it's in Dev's queue to be fixed.
Ravi kumar Veeramally

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 16, 2016

by Ravi kumar Veeramally:

As per the bug description stack doesn't handle disconnect/close flag. I have tried with few scenarios where client application connects and disconnects. Provided pcap logs. It seems fine.

But actual bug is GH-2157, where MQTT client connect and disconnect and in a loop its trying to connect/disconnect again. Looks like some issue in reconnection as per its description. I am investigating it. Asked bit more details in GH-2157.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 16, 2016

by Ravi kumar Veeramally:

Flavio, Finally I could reproduce the GH-2157 issue. Looks like this bug doesn't have enough information to reproduce GH-2157 scenario and seems duplicate of it. So I recommend mark this one as duplicate to GH-2157 and let's figure it out. What do you say?

Please check my comments in GH-2157.

@zephyrbot
Copy link
Collaborator Author

by Flavio Santes:

Ravi kumar Veeramally : sounds good to me.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 18, 2016

by Kuo-Lang Tseng:

Based on comments from Ravi kumar Veeramally and Flavio Santes , closing this as duplicate of GH-2157.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 18, 2016

Blocks GH-1970

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 18, 2016

Blocks GH-1969

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 18, 2016

Blocks GH-2015

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Aug 18, 2016

Blocks GH-2157

@zephyrbot zephyrbot added priority: high High impact/importance bug area: Networking bug The issue is a bug, or the PR is fixing a bug labels Sep 23, 2017
@zephyrbot zephyrbot added this to the v1.5.0 milestone Sep 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants