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

Garbage when clients don't disconnect #72

Open
ghost opened this issue May 5, 2018 · 6 comments
Open

Garbage when clients don't disconnect #72

ghost opened this issue May 5, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented May 5, 2018

It seems that if clients (or even the same client) reconnect without disconnect first, they will receive garbage chars.
For example in an html page I have a "Connect" button:

  1. load the page
  2. press connect
  3. open the port and all is fine
  4. reload the page, without disconnect first
  5. try to connect again - ok
  6. open the port - ok
  7. now the received data is wrong, with all the chars shuffled

To get the things back to work I have to restart the serial-port-json-server.
it's a known behavior? Is there a way to avoid this? I'm interested in only one client at time, so it would be fine to forcefully disconnect any client before accept a new connection.

@chilipeppr
Copy link
Collaborator

chilipeppr commented May 5, 2018 via email

@chilipeppr
Copy link
Collaborator

chilipeppr commented May 5, 2018 via email

@chilipeppr
Copy link
Collaborator

chilipeppr commented May 5, 2018 via email

@ghost
Copy link
Author

ghost commented May 5, 2018

Sorry you're right. I didn't notice I was on the wrong page. Do you think it's better I move the question there?

@johnlauer
Copy link
Owner

johnlauer commented May 5, 2018 via email

@TemperedEnterprises
Copy link

This issue was documented by me way back in 2016 - but because I lack personal skills it was ignored.

https://www.youtube.com/watch?v=70uAKhbGXIk

The issue has to do with the handling of the PORT open command. The SPJS expects the user to check if the port is open before opening the port. If the user opens the same port multiple times, my guess is that the SPJS software just creates more threads parsing input of the serial port. So some characters go to one thread but other characters are handled by a different thread. It basically breaks the parsing of JSON.

An easy fix would be to simply check to see if the port is open, and if the port open request is based on the same parameters, just ignore the request. Otherwise, just close the port and re-open it? << this last idea could be problematic if you are in a CNC program executing and someone opens up a new terminal on a new workstation.

But as my experience with code and troubleshooting is not appreciated here - I will not be publishing the fix.

It truly is sad, here I came with an issue and was willing to troubleshoot it, isolate the bad code, publish my findings, and probably would have created a patch. But when I submitted the issue. instead of accepting that I could have something to bring to this project, the admins assumed I just didn't know what I was going.

Then got really irate and "offended" when I tried to explain I didn't need help - i was here to help.

Anyways - good luck with a bug the developers refuse to fix because I brought it to them and they hate me over trivialness.

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

3 participants