Comments (4)
This is not by design, so it's probably a bug - while technically channel layers are allowed to drop messages, dropping 70 left in the queue is a bit much.
I would recommend using the Redis channel layer if you want something more reliable, it's much more proven.
from asgi_ipc.
I have only a small project on one machine. Redis would be an overhead I'd like to avoid. But thanks for the hint, though!
Oh, and I was not dropping 70 messages. I edited/condensed the code to make it more obvious what is happening. I also get an exception at the end. Not sure why, though. When I debug the code line per line I don't get one. Maybe an issue with execution speed or something?
from asgi_ipc.
The issue is caused by
Line 296 in f1d205c
unlink()
marks the shared memory for destruction once all processes have unmapped it.
Source: http://semanchuk.com/philip/posix_ipc/
Not exactly sure how this works here because within a single process we have two SharedMemory
objects that map the same shared memory. However if I unlink()
one of the objects, the shared memory gets destroyed although the second objects has it still mapped.
Now this happens, minus the part where it says "after the last shm_unlink()":
"Even if the object continues to exist after the last shm_unlink(), reuse of the name shall subsequently cause shm_open() to behave as if no shared memory object of this name exists (that is, shm_open() will fail if O_CREAT is not set, or will create a new shared memory object if O_CREAT is set)."
Source: http://www.opengroup.org/onlinepubs/009695399/functions/shm_unlink.html
The quick fix is to simply not call unlink()
, but then the shared memory needs to be unlinked manually by calling unlink_shared_memory(name)
.
Initially I had the issue with send()
and receive()
being in two separate scripts/processes. I will have to test whether the issue is actually the same.
from asgi_ipc.
Urgh, yes, that seems to be what this is; it behaves differently if it's two inside one process versus two in different processes.
I'm still very much tempted to try out a sqlite-based backend as a replacement for this shared memory stuff, given that the performance testing we did showed this was surprisingly slow.
from asgi_ipc.
Related Issues (20)
- Unresolved attribute reference `self.hosts` HOT 1
- Running channels as non-root user gives "posix_ipc.PermissionsError: Permission denied" HOT 4
- MemoryDatastructure and double acquisition of semaphores HOT 1
- TypeError: Struct() argument 1 must be string, not unicode while testing
- Starting daphne causes ValueError: The size is invalid or the memory is read-only HOT 2
- Address slow performance HOT 1
- Potential message duplication HOT 1
- Move IPC layer to use SQLite in either a file or a shared memory segment HOT 1
- Don't use pkg_resources to get version number HOT 1
- Unable to use layer inside docker container. HOT 10
- Sending messages to channels via celery HOT 3
- Unable to use layer with python 3.6 HOT 3
- MemoryError on large uploads HOT 1
- Semaphores don't get created on Alpine Linux HOT 2
- Asgiref 2.0.1 version conflict HOT 4
- Outdate asgiref HOT 1
- shared memory segment and semaphore names suffixes are too large for OS X HOT 3
- ./manage.py runworker randomly crashes at startup HOT 3
- Suggestion: Raise a ValueError exception if receive()'s "channels" argument is not of type "list". HOT 7
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 asgi_ipc.