Skip to content

uasyncio / EAGAIN #30

Closed
Closed
@c0d3z3r0

Description

@c0d3z3r0

Hi there,

I am having the same issue that should have been fixed in micropython/micropython#4322

Test code:

import uasyncio as asyncio

@asyncio.coroutine
async def serve(reader, writer):
  request = yield from reader.read()
  print((yield from reader.read()))
  yield from writer.awrite("ok\r\n")
  yield from writer.aclose()

def run():
  loop = asyncio.get_event_loop()
  loop.create_task(asyncio.start_server(serve, "127.0.0.1", 80))
  loop.run_forever()
  loop.close()
MicroPython v1.10-579-ga64fa0e8e on 2019-05-30; ESP module with ESP8266
Type "help()" for more information.
>>> import micropython
>>> micropython.mem_info()
stack: 2112 out of 8192
GC: total: 37952, used: 5280, free: 32672
 No. of 1-blocks: 24, 2-blocks: 11, max blk sz: 264, max free sz: 2025
>>> 
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import uasyncio as asyncio
=== 
=== @asyncio.coroutine
=== async def serve(reader, writer):
===   request = yield from reader.read()
===   print((yield from reader.read()))
===   yield from writer.awrite("ok\r\n")
===   yield from writer.aclose()
=== 
=== def run():
===   loop = asyncio.get_event_loop()
===   loop.create_task(asyncio.start_server(serve, "127.0.0.1", 80))
===   loop.run_forever()
===   loop.close()
>>> run()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 13, in run
  File "uasyncio/core.py", line 163, in run_forever
  File "uasyncio/core.py", line 116, in run_forever
  File "uasyncio/__init__.py", line 252, in start_server
OSError: [Errno 11] EAGAIN
>>> run()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 13, in run
  File "uasyncio/core.py", line 163, in run_forever
  File "uasyncio/core.py", line 116, in run_forever
  File "uasyncio/__init__.py", line 245, in start_server
OSError: [Errno 12] ENOMEM
>>> run()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 13, in run
  File "uasyncio/core.py", line 163, in run_forever
  File "uasyncio/core.py", line 116, in run_forever
  File "uasyncio/__init__.py", line 245, in start_server
OSError: [Errno 12] ENOMEM
>>> micropython.mem_info()
stack: 2112 out of 8192
GC: total: 37952, used: 12112, free: 25840
 No. of 1-blocks: 152, 2-blocks: 35, max blk sz: 264, max free sz: 1605

What could be wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions