-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaxConcurrency failing to release #9995
Comments
The semaphore class is quite similar to the standard library's implementation so its usage should be quite similar and has been bug free for a while. It's hard to know how you're running into a deadlock so more information is needed. |
I've had the same issue for quite awhile. My temporary solution was writing an internal task to periodically check for specific commands with stuck semaphores and remove them manually. I'm not sure how it's caused or how to really reproduce this and as @rxnk had mentioned, it is random and only happens on commands that are bound to potential spam or high usage. For instance, I have a Here's a code snippet of the command if necessary: @hybrid_group(
name="play",
aliases=["p"],
max_concurrency=MaxConcurrency(1, per=BucketType.channel, wait=False),
)
async def play(self, ctx: Context, *, query: str):
"""
Queue a track
"""
tracks: Client = await ctx.voice.get_tracks(query, ctx=ctx)
if not tracks:
return await ctx.missing(f"No **results** found for `{query[:25]}`")
await ctx.typing()
if isinstance(tracks, Playlist):
for track in tracks.tracks:
await sleep(0)
if track.length / 1000 >= 3600:
continue
ctx.voice.queue.put(track)
await ctx.send(f"Added **{len(tracks.tracks)} tracks** from [`{tracks.name}`]({tracks._uri})")
else:
track = tracks[0]
track.requester = ctx.author
ctx.voice.queue.put(track)
await ctx.send(f"Added [`{track.title}`]({track}) to `{ctx.voice.queue._index(track)+1}` in the **queue**")
ctx.voice.queue.recommended.clear()
if not ctx.voice.is_playing:
await ctx.voice.do_next() I'm not sure exactly what information is needed but hopefully this helps and if more is needed, please let me know. |
This has been problem since 2022 (#8071) which was on a completely different code structure but was never resolved. |
The issue you linked was never reproduced and there's no compelling reason to think this is a library issue with the available information in either their or your examples. |
Summary
The MaxConcurrencyReached exc is being raised no matter what
Reproduction Steps
It's usually happens on commands that are frequently used (high traffic) and happens randomly.
Minimal Reproducible Code
Expected Results
The concurrency is supposed to be released after the first use
Actual Results
The MaxConcurrencyReached error is being raised after the command has finished.
Intents
all
System Information
Checklist
Additional Context
I've skimmed through the Semaphore class which this depends on and I determined this could be caused by a deadlock
The text was updated successfully, but these errors were encountered: