TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT not present in all operating systems
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 491
- Forks
- 290
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 3
Description
After upgrading one of my pymisp instances that runs on OpenBSD system to 2.4.160, it presented the following error:
In [1]: import pymisp
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-a87cdefbe0c6> in <module>
----> 1 import pymisp
~/MISP/PyMISP/lib/python3.9/site-packages/pymisp/__init__.py in <module>
42 from .tools import update_objects # noqa
43
---> 44 from .api import PyMISP, register_user # noqa
45 from .api import PyMISP as ExpandedPyMISP # noqa
46 from .tools import load_warninglists # noqa
~/MISP/PyMISP/lib/python3.9/site-packages/pymisp/api.py in <module>
35 HTTPConnection.default_socket_options =
HTTPConnection.default_socket_options + [
36 (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), # enable keepalive
---> 37 (socket.SOL_TCP, socket.TCP_KEEPIDLE, 30), # Start pinging after 30s of idle time
38 (socket.SOL_TCP, socket.TCP_KEEPINTVL, 10), # ping every 10s
39 (socket.SOL_TCP, socket.TCP_KEEPCNT, 6) # kill the connection if 6 ping fail (60s total)
AttributeError: module 'socket' has no attribute 'TCP_KEEPIDLE'
The attributes TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT from socket module are not present in all operating systems.
Any chance of making this code portable?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pymisp/api.py at the HTTPConnection.default_socket_options setup shown in the traceback, then reproduce the import on OpenBSD or another system missing these socket attributes. Done means importing pymisp no longer raises AttributeError on operating systems that do not provide TCP_KEEPIDLE, TCP_KEEPINTVL, or TCP_KEEPCNT.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100