MagicStack / MagicStack/uvloop

Transport sockets do not support shutdown() method

Open
#241 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

need to fix asyncio
Dominant language
Cython
Stars
11.9k
Forks
616
PR merge metrics
No merged PRs in 30d

Description

  • uvloop version: 0.12.2
  • Python version: 3.5.3
  • Platform: Debian 9
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

An attempt to use shutdown method of transport socket causes following exception:

source_traceback: Object created at (most recent call last):
  File "/usr/local/bin/ssh-tarpit", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/ssh_tarpit/__main__.py", line 109, in main
    loop.run_until_complete(amain(args, loop))
  File "/usr/lib/python3.5/asyncio/streams.py", line 238, in connection_made
    self._stream_writer)
  File "/usr/local/lib/python3.5/dist-packages/ssh_tarpit/server.py", line 52, in _spawn
    self._loop.create_task(self.handler(reader, writer)))
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3.5/asyncio/coroutines.py", line 125, in send
    return self.gen.send(value)
  File "/usr/local/lib/python3.5/dist-packages/ssh_tarpit/server.py", line 38, in handler
    sock.shutdown(socket.SHUT_RD)
  File "uvloop/pseudosock.pyx", line 155, in uvloop.loop.PseudoSocket.shutdown
  File "uvloop/pseudosock.pyx", line 19, in uvloop.loop.PseudoSocket._na
TypeError: transport sockets do not support shutdown() method

Such behavior is not observed with default event loop.

Contributor guide

No contributing guide indexed for this repository

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

Read uvloop/pseudosock.pyx at PseudoSocket.shutdown and the _na path shown in the traceback; begin by reproducing the socket shutdown call under the reported Python and uvloop versions. Done means the transport socket handles shutdown without the reported TypeError and matches the default event loop's behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.