robotpy / pynetworktables

Pure python implementation of the FRC NetworkTables protocol
Other
60 stars 30 forks source link

issue running as server 'read error in handshake: end of file' #84

Open dbadb opened 5 years ago

dbadb commented 5 years ago

platform windows 10, python3.7.2 native build, pynetworktables version 2019.0.0

in one git-bash window, i start a pynetworktables server:

networktables.NetworkTables.initialize()

in another git-bash window, I start a pynetworktables client:

networktables.NetworkTables.initialize(server="localhost")

back in the server window, i see a stream like this:

read error in handshake: end of file
read error in handshake: end of file
read error in handshake: end of file
read error in handshake: end of file
read error in handshake: end of file

fwiw: connections to robot-based server appear solid, just trying to get work done without a robot.

virtuald commented 5 years ago

Hm. I don't know what's happening here. Did you enable logging as shown in the examples? Set the level to DEBUG and perhaps that output will be more useful.

# To see messages from networktables, you must setup logging
import logging
logging.basicConfig(level=logging.DEBUG)

Also, what is your client doing? If it exits immediately, then that's your problem. Try the nt_driverstation.py example.

dbadb commented 5 years ago

thanks for the rapid response! (and thanks for all that is robotpy!)

here's what i'm seeing:

  1. start the server as above but with more logging:
  2. start the nt_driverstation.py (with server == "localhost")

in the server:

networktables.NetworkTables.initialize()
INFO:nt:NetworkTables initialized in server mode
DEBUG:nt.th:Started thread nt-dispatch-thread-0
DEBUG:nt.th:Started thread nt-server-thread-0
True
>>> DEBUG:nt:Listening on  1735
DEBUG:nt:server: client connection from 127.0.0.1 port 53199
DEBUG:nt.th:Started thread nt-net-write-0
DEBUG:nt.th:Started thread nt-net-read-0
WARNING:nt:read error in handshake: end of file
DEBUG:nt:server: client disconnected before sending hello
INFO:nt:DISCONNECTED 127.0.0.1 port 53199 (None)
DEBUG:nt.th:Thread nt-net-read-0 exited
DEBUG:nt.th:Thread nt-net-write-0 exited
DEBUG:nt:server: client connection from 127.0.0.1 port 53201
DEBUG:nt.th:Started thread nt-net-write-1
DEBUG:nt.th:Started thread nt-net-read-1
WARNING:nt:read error in handshake: end of file
DEBUG:nt:server: client disconnected before sending hello
INFO:nt:DISCONNECTED 127.0.0.1 port 53201 (None)
DEBUG:nt.th:Thread nt-net-read-1 exited
DEBUG:nt.th:Thread nt-net-write-1 exited
DEBUG:nt:server: client connection from 127.0.0.1 port 53203
DEBUG:nt.th:Started thread nt-net-write-2
DEBUG:nt.th:Started thread nt-net-read-2
WARNING:nt:read error in handshake: end of file
DEBUG:nt:server: client disconnected before sending hello
INFO:nt:DISCONNECTED 127.0.0.1 port 53203 (None)
DEBUG:nt.th:Thread nt-net-read-2 exited
DEBUG:nt.th:Thread nt-net-write-2 exited
DEBUG:nt:server: client connection from 127.0.0.1 port 53205
DEBUG:nt.th:Started thread nt-net-write-3
DEBUG:nt.th:Started thread nt-net-read-3
WARNING:nt:read error in handshake: end of file
DEBUG:nt:server: client disconnected before sending hello
INFO:nt:DISCONNECTED 127.0.0.1 port 53205 (None)
DEBUG:nt.th:Thread nt-net-read-3 exited
DEBUG:nt.th:Thread nt-net-write-3 exited
DEBUG:nt:server: client connection from 127.0.0.1 port 53207
DEBUG:nt.th:Started thread nt-net-write-4
DEBUG:nt.th:Started thread nt-net-read-4
WARNING:nt:read error in handshake: end of file
DEBUG:nt:server: client disconnected before sending hello
INFO:nt:DISCONNECTED 127.0.0.1 port 53207 (None)
DEBUG:nt.th:Thread nt-net-read-4 exited
DEBUG:nt.th:Thread nt-net-write-4 exited

and in the client:

python client.py
INFO:nt:NetworkTables initialized in client mode
DEBUG:nt.th:Started thread nt-dispatch-thread-0
DEBUG:nt.th:Started thread nt-client-thread-0
robotTime: N/A
robotTime: N/A
robotTime: N/A
robotTime: N/A
robotTime: N/A
robotTime: N/A
robotTime: N/A
robotTime: N/A
robotTime: N/A
virtuald commented 5 years ago

I've no idea. Do you perhaps have a firewall enabled that might be killing the connection oddly? Unfortunately, I don't have a Windows 10 machine available to me at this time that I could test this with.

dbadb commented 5 years ago

Hm - I had thought of that and had whitelisted python. But just to be certain, i just disabled all three firewalls (public, private and domain) and still see the same behavior. I'll keep you posted if I learn more. thx!

dbadb commented 5 years ago

btw: I can confirm that the same combination of scripts works on my mac laptop

virtuald commented 5 years ago

Any news here?

dbadb commented 5 years ago

no new news with all the excitement of the build season. i did just re-verify that the condition persists on my windows 10 machine with python37 (windows native) plus pynetworktables 2019.0.0

virtuald commented 5 years ago

I just setup a clean Windows 10 VM, installed Python 3.7.2, installed pynetworktables from pip, and ran the nt_robot.py / nt_driverstation.py programs. The firewall asked me if I wanted to allow the programs to communicate, and I said yes. They were able to send values back and forth without any problem.

I'm guessing you have something on your machine that is causing this issue. Recommend that you double-check your firewall configuration, and disable any antivirus.

dbadb commented 5 years ago

completely agree that it smells machine specific. as i mentioned earlier, i believe i've disproved the theory that it's firewall related. It would be interesting if the problem turns out to be related to the national instruments installation.

On Fri, Feb 15, 2019 at 3:01 PM Dustin Spicuzza notifications@github.com wrote:

I just setup a clean Windows 10 VM, installed Python 3.7.2, installed pynetworktables from pip, and ran the nt_robot.py / nt_driverstation.py programs. The firewall asked me if I wanted to allow the programs to communicate, and I said yes. They were able to send values back and forth without any problem.

I'm guessing you have something on your machine that is causing this issue. Recommend that you double-check your firewall configuration, and disable any antivirus.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/robotpy/pynetworktables/issues/84#issuecomment-464238029, or mute the thread https://github.com/notifications/unsubscribe-auth/AOlyznVnoeUtk_O7ut8tN5tal6NMccMQks5vNzxKgaJpZM4adbzX .