YoSTEALTH / Liburing

Liburing is Python + Cython wrapper around C Liburing, which is a helper to setup and tear-down io_uring instances.
https://pypi.org/project/liburing/
Creative Commons Zero v1.0 Universal
98 stars 3 forks source link

Core dump on probe and bad file descriptor on read. #15

Closed mjsML closed 3 years ago

mjsML commented 3 years ago

installed using the latest version via GitHub.

Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import liburing
>>> probe = liburing.probe()
[1]    30282 segmentation fault (core dumped)  python3

I tried to run the full example program to try to catch the trace:

Exception has occurred: OSError
[Errno 9] Bad file descriptor
  File "/home/mjs/test_liburing.py", line 44, in _submit_and_wait
    result = trap_error(cqe.res)  # auto raise appropriate exception if failed
  File "/home/mjs/test_liburing.py", line 12, in open
    return _submit_and_wait(ring, cqes)  # returns fd
  File "/home/mjs/test_liburing.py", line 58, in main
    fd = open(ring, cqes, '~/liburing-test-file.txt', os.O_CREAT | os.O_RDWR)
  File "/home/mjs/test_liburing.py", line 74, in <module>
    main()

PS: I noticed that liburing updated to version 2.1 few hours ago while this is using version 2.0.

YoSTEALTH commented 3 years ago

Helper function probe which uses io_uring_get_probe is a feature added in Linux 5.6 https://unixism.net/loti/ref-liburing/supported_caps.html?highlight=probe#c.io_uring_get_probe

As for OSError, it has to do with you changing the path to ~/liburing-test-file.txt in python you can't use ~, you have to use it like so os.path.expanduser('~/liburing-test-file.txt')

Cool 2.1 is out! Most of its feature are for Linux 5.14/5.15+ so no worries there. I will update within few days.

mjsML commented 3 years ago

Helper function probe which uses io_uring_get_probe is a feature added in Linux 5.6 https://unixism.net/loti/ref-liburing/supported_caps.html?highlight=probe#c.io_uring_get_probe

Thank you for letting me know 😄

As for OSError, it has to do with you changing the path to ~/liburing-test-file.txt in python you can't use ~, you have to use it like so os.path.expanduser('~/liburing-test-file.txt')

@YoSTEALTH even with fully expanded path it blows up 😢

Exception has occurred: OSError
[Errno 9] Bad file descriptor
  File "/home/mjs/test_liburing.py", line 44, in _submit_and_wait
    result = trap_error(cqe.res)  # auto raise appropriate exception if failed
  File "/home/mjs/test_liburing.py", line 12, in open
    return _submit_and_wait(ring, cqes)  # returns fd
  File "/home/mjs/test_liburing.py", line 58, in main
    fd = open(ring, cqes, '/home/mjs/test2.txt', os.O_CREAT | os.O_RDWR)
  File "/home/mjs/test_liburing.py", line 74, in <module>
    main()
YoSTEALTH commented 3 years ago

Sorry @mjsML the open in the example uses io_uring_prep_openat which was also implemented in Linux 5.6, also close uses io_uring_prep_close its Linux 5.6 as well. Since io_uring is new, most of the feature support are in newer version of the kernel.

mjsML commented 3 years ago

@YoSTEALTH Thank you for the info, I'll try to upgrade my kernel if possible and let you know 😄