Comments (23)
I've got the same problem when using aiofile.
from caio.
I think It's fixed in caio==0.6.0
from caio.
aiofile 3.0.0 requires caio~=0.5.3, but you'll have caio 0.6.0 which is incompatible.
from caio.
Oh. My bad
from caio.
@honglei aiofile==3.1.0
has been released.
from caio.
@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.
My kernel is 4.4.15 and I cannot update it, when using fsync
, it raised "Bad file descriptor" Error.
from caio.
@mosquito I think caio should choose to use theaded-mode if it cannot work correctly before linux kernel 4.18
from caio.
@honglei that's will happen transparently for you. When caio importing selects preferred implementation.
from caio.
@mosquito But under Linux 4.4.15/Python3.8/caio 0.60, caio.preferred
is caio.linux_aio
from caio.
@mosquito But under Linux 4.4.15/Python3.8/caio 0.60,
caio.preferred
iscaio.linux_aio
@honglei Please provide uname -r
output.
from caio.
4.4.15-deepin-wutip-421-inspur-monitor-native-debugless
from caio.
>>> 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.
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.
@FFY00 @honglei Thanks for your persistence, it's really my bug. I found a solution and soon will release it.
from caio.
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.
@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.
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.
@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.
@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.
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.
@mosquito I think the last modification only give a warning, but have no effect for caio.preferred
selection.
from caio.
@honglei please see Troubleshooting
part in README.rst
from caio.
Related Issues (10)
- i586 Bad address HOT 5
- Failed to write more than 2Gb to file HOT 1
- linux_aio : ImportError: Error on io_setup with code 22 HOT 3
- CPython optimize flags cause readline to hang HOT 1
- Missing loop fixture with aiomisc 17 HOT 2
- Mac build fails due to fdatasync
- aiofile fails with new version of caio HOT 1
- Build fails with gcc 14.1.1
- PyPI sdist doesnt contain LICENSE HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caio.