guyzmo / guyzmo/event-source-library

confusing error on port mismatch

Open
#14 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
34
Forks
8
PR merge metrics
No merged PRs in 30d

Description

- install event-source-library via pip install
- run server on non-defaul port: `eventsource-server -P 8888 -i -k 50000`
- try to tun client on default port: `eventsource-client 42:42:42:42:42:42 -r 5000` - it will terminate with following error:

```
Traceback (most recent call last):
File "/home/msuraev/.local/lib/python2.7/site-packages/eventsource/client.py", line 139, in handle_stream
(field, value) = line.split(":", 1)
ValueError: need more than 1 value to unpack
ERROR:eventsource.client:HTTP 599: Failed writing body (0 != 877)
```

Hmm, looking further into this, seems like it's not the port to be blamed - I've got the same error if I run `eventsource-server -i -k 50000` instead.

Note, that running both client and the server with `-P 8888` fixes it. What's the default port used if `-P` not specified? In general, I think every option with default value should explicitly mention that value in '--help' output to make troubleshooting easier.

Incidentally, trying to connect with some "empty" port leads to expected error:

```
eventsource-client 42:42:42:42:42:42 -r 5000 -P 1111

ERROR:eventsource.client:HTTP 599: Failed to connect to 127.0.0.1 port 1111: Connection refused
```

So it seems like `eventsource-client` got confused by smth else running on the default port but I don't understand how it's possible - if the port is already occupied than `eventsource-server` would have complained about it?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.