lbryio / lbryio/lbry-sdk

uncaught sendfile error on shutdown

Open
#2,147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: blob exchange type: bug
Dominant language
Python
Stars
7.2k
Forks
493
PR merge metrics
No merged PRs in 30d

Description

handle: <Handle cancelled>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/unix_events.py", line 361, in _sock_sendfile_native_impl
    sent = os.sendfile(fd, fileno, offset, blocksize)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/asyncio/unix_events.py", line 390, in _sock_sendfile_native_impl
    self._sock_sendfile_update_filepos(fileno, offset, total_sent)
  File "/usr/local/lib/python3.7/asyncio/unix_events.py", line 411, in _sock_sendfile_update_filepos
    os.lseek(fileno, offset, os.SEEK_SET)
OSError: [Errno 9] Bad file descriptor```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Python's asyncio sendfile implementation in /usr/local/lib/python3.7/asyncio/unix_events.py, especially _sock_sendfile_native_impl and _sock_sendfile_update_filepos. Investigate how shutdown reaches the cancelled callback and determine what test or reproduction can demonstrate the uncaught error. Done means shutdown no longer emits this Bad file descriptor traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.