Skip to content

OSError: [Errno 9] Bad file descriptor when trying to write file #2

@lezwon

Description

@lezwon

Hi, I tried running this code:

import string
import asyncio
import uring_file
import os

async def main():
    path = 'test.txt'

    f = uring_file.File(path)
    await f.open(os.O_CREAT | os.O_WRONLY)
    await f.write(b'hello\nworld')
    await f.close()


if __name__ == "__main__":
    asyncio.run(main())

I get the following error:

ubuntu@pc:~$ python3 main.py 
Exception in callback Uring.eventfd_callback()
handle: <Handle Uring.eventfd_callback()>
Traceback (most recent call last):
  File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/home/ubuntu/uring_file.py", line 48, in eventfd_callback
    result = liburing.trap_error(cqe.res)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/liburing/wrapper.py", line 27, in trap_error
    raise OSError(-no, strerror(-no))
OSError: [Errno 9] Bad file descriptor

These are the system details. It is an AWS machine.

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal
5.4.0-1038-aws

I installed liburing from source. Could you tell me if I'm doing something wrong?

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