Giter VIP home page Giter VIP logo

Comments (23)

honglei avatar honglei commented on June 12, 2024

I've got the same problem when using aiofile.

from caio.

mosquito avatar mosquito commented on June 12, 2024

I think It's fixed in caio==0.6.0

from caio.

honglei avatar honglei commented on June 12, 2024

aiofile 3.0.0 requires caio~=0.5.3, but you'll have caio 0.6.0 which is incompatible.

from caio.

mosquito avatar mosquito commented on June 12, 2024

Oh. My bad

from caio.

mosquito avatar mosquito commented on June 12, 2024

@honglei aiofile==3.1.0 has been released.

from caio.

mosquito avatar mosquito commented on June 12, 2024

@honglei actually you should use Linux kernel >=4.18 it's was not a bug that's was the fixes avoiding compatibility issue. io_submit system call supports all required features since Linux 4.18.

The thread-based implementation will be used otherwise.

from caio.

honglei avatar honglei commented on June 12, 2024

My kernel is 4.4.15 and I cannot update it, when using fsync , it raised "Bad file descriptor" Error.

from caio.

honglei avatar honglei commented on June 12, 2024

@mosquito I think caio should choose to use theaded-mode if it cannot work correctly before linux kernel 4.18

from caio.

mosquito avatar mosquito commented on June 12, 2024

@honglei that's will happen transparently for you. When caio importing selects preferred implementation.

from caio.

honglei avatar honglei commented on June 12, 2024

@mosquito But under Linux 4.4.15/Python3.8/caio 0.60, caio.preferred is caio.linux_aio

from caio.

mosquito avatar mosquito commented on June 12, 2024

@mosquito But under Linux 4.4.15/Python3.8/caio 0.60, caio.preferred is caio.linux_aio

@honglei Please provide uname -r output.

from caio.

honglei avatar honglei commented on June 12, 2024

4.4.15-deepin-wutip-421-inspur-monitor-native-debugless

from caio.

honglei avatar honglei commented on June 12, 2024
>>> os.uname()
posix.uname_result(sysname='Linux', nodename='lccy6', release='4.4.15-deepin-wutip-421-inspur-monitor-native-debugless', version='#298 SMP Mon Jun 29 14:14:12 CST 2020', machine='sw_64')

from caio.

FFY00 avatar FFY00 commented on June 12, 2024

Hi! I am running Linux 5.8.3 and just updated to caio 0.6.0, still the same thing 😕

$ uname -a
Linux genesis 5.8.3-arch1-1 #1 SMP PREEMPT Fri, 21 Aug 2020 16:54:16 +0000 x86_64 GNU/Linux
$ python -c 'import caio; print(caio.__version__)'
0.6.0

from caio.

mosquito avatar mosquito commented on June 12, 2024

@FFY00 @honglei Thanks for your persistence, it's really my bug. I found a solution and soon will release it.

from caio.

honglei avatar honglei commented on June 12, 2024

Maybe this way:

import os
if os.name =='posix':
    os_version = os.uname().release.split("-")[0]
    version = tuple( [int(i) for i in os_version.split(".")])
    if version<(4,18):
        print("thread_aio")
    else:
        print("linux_aio")

from caio.

mosquito avatar mosquito commented on June 12, 2024

@honglei actually something like this but on c. Anyway, 0.6.1 has been released. I will happy if you try to check this out.

from caio.

FFY00 avatar FFY00 commented on June 12, 2024

Unfortunately this still doesn't fix my issue. My kernel is very recent, do you have any idea why this might not be working?

from caio.

mosquito avatar mosquito commented on June 12, 2024

@FFY00 it's happening when the kernel is not able to perform the asynchronous operation with this file. I found a problem with fsync/fdsync operations on old kernels, and avoid this. I guess that's isn't the last issue with old kernels, but when you bring some details e.g. environment, kernel version Linux distro, etc. I might reproduce this on VM, I guess, and try to resolve it, or restrict libaio based implementation for this kernel as a bad case.

from caio.

mosquito avatar mosquito commented on June 12, 2024

@FFY00 So after fast reading the documentation about UHID I found out this:

Non-blocking operations are supported by setting O_NONBLOCK.

Probably you do not need use caio for this (I guess kernel is not able to handle this file descriptor) try something like this:

import os, asyncio, fcntl

f = open(...)

rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NONBLOCK)


def ready_to_read(fp):
    pass


def ready_to_write(fp):
    pass


loop = asyncio.get_event_loop()
loop.add_reader(f.fileno(), ready_to_read, f)
loop.add_writer(f.fileno(), ready_to_write, f)

from caio.

honglei avatar honglei commented on June 12, 2024

Still linux_aio under kernel 4.4.15

lccy@lccy6:/opt/python38/bin$ ./python3
Python 3.8.4rc1 (default, Jul  1 2020, 11:44:28)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import caio
<frozen importlib._bootstrap>:219: RuntimeWarning: Linux supports fsync/fdsync with io_submit since 4.18 but current kernel 4.4.15-deepin-wutip-421-inspur-monitor-native-debugless doesn't support it. Related calls will have no effect.
>>> caio.preferred
<module 'caio.linux_aio' from '/opt/python38/lib/python3.8/site-packages/caio/linux_aio.cpython-38.so'>
>>> caio.__version__
'0.6.1'
>>> os.uname()
posix.uname_result(sysname='Linux', nodename='lccy6', release='4.4.15-deepin-wutip-421-inspur-monitor-native-debugless', version='#298 SMP Mon Jun 29 14:14:12 CST 2020', machine='sw_64')

from caio.

honglei avatar honglei commented on June 12, 2024

@mosquito I think the last modification only give a warning, but have no effect for caio.preferred selection.

from caio.

mosquito avatar mosquito commented on June 12, 2024

@honglei please see Troubleshooting part in README.rst

from caio.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.