Comments (4)
It's not just a consequence of optimization, the lock is literally right before the destroy call in the code. No amount of sleeping will change that.
/* Because we allocate pool->threads after initializing the
mutex and condition variable, we're sure they're
initialized. Let's lock the mutex just in case. */
pthread_mutex_lock(&(pool->lock));
pthread_mutex_destroy(&(pool->lock));
https://linux.die.net/man/3/pthread_mutex_destroy
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_destroy.html
Attempting to destroy a locked mutex results in undefined behavior.
I'd imagine that this is actually "harmless" in practice, but for what reason is it being locked before being destroyed? If we need that lock there, then just inserting an unlock immediately afterwards would suffice to comply with the POSIX standard. The only concern I see is if you think something else could lock it between the unlock and the destroy, but if you've got other threads still trying to use the mutex at that point then you've got bigger issues.
from concord.
I suspect that this is not an actual bug, but a consequence of pthread's optimization, see: https://stackoverflow.com/a/68514238
I had also come across a similar error when running my application under valgrind, but after some research I came to the conclusion that it's a harmless "leak". You can probably circumvent it by having your process sleep for a little while before termination. If you believe that your issue is unrelated to this, feel free to re-open this issue.
from concord.
I'll take a better look at this once I get home, I may have mixed up your issue with something else I was having. My bad for just assuming.
It's not just a consequence of optimization, the lock is literally right before the destroy call in the code. No amount of sleeping will change that.
In the meantime, can you confirm that changing the ordering fixes the issue? If so, could you please open a PR fixing it?
from concord.
Just to give a bit of a context, the issue arises from how this third-party threadpool lib manages its clean up. We can either look for an alternative (C99 compliant) threadpool implementation, write our own, or fix this one (and send a fix PR to the original's out of courtesy).
from concord.
Related Issues (20)
- Unable to link concord static library to a shared library. HOT 7
- Support HTTP 1.1
- Add guides to Concord HOT 11
- Websocket payloads taking long to be sent HOT 3
- Chash (used on Concord) possible not working on FreeBSD HOT 1
- Segfault due to race conditions in discord_cleanup when called from another thread HOT 7
- Incomplete presence info and guild members HOT 15
- discord_modify_channel rtc_region issue HOT 2
- Insufficient buffer size causes truncation, malformed request
- Signal Safety in concord-once.h HOT 2
- Make Error - Windows, Cygwin HOT 3
- WebSocket upgrade fails with 'server didn't accept the websocket upgrade' error when using an HTTP proxy HOT 1
- Raspberry Pi (64-bit) library setup problem HOT 3
- Easy server member permission checking HOT 1
- Wrong compiler for discord_codecs breaks cross HOT 6
- User-defined memory functions HOT 4
- Ship a pkg-config file
- messages: Support silent flag HOT 12
- `DISCORD_MAX_MESSAGE_LEN` has the wrong value HOT 3
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 concord.