question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Operation timeout with creation of 6+ shards

See original GitHub issue

Check The Docs

  • I double checked the docs and couldn’t find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

Note: Please view edit history to see the original purpose of this issue.

If you create a sharded client with 6 or more shards, at around the 6th shard, all shards are prevented from running. The bot will continue to receive dispatches but will be unable to actually process the events (debug logging notes the dispatches but handlers are not being invoked).

This may relate to one of my old issues: #2126

Version

3.11.0

Working Version

No response

Logs

[2023-08-01T03:43:27.3327Z][0029][][KVEX-WIN-234][bot][ERROR] DiscordInternal-EXCEPTION-Shard #6:
Error Type: System.TimeoutException
Error Detail: The operation has timed out.
Inner Exception:
Exception Stack Trace:
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Discord.ConnectionManager.<WaitAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Discord.WebSocket.DiscordSocketClient.<OnConnectingAsync>d__118.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Discord.ConnectionManager.<ConnectAsync>d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Discord.ConnectionManager.<>c__DisplayClass29_0.<<StartAsync>b__0>d.MoveNext()
Exception Source: mscorlib
Exception TargetSite: Void Throw()
Exception Data: System.Collections.ListDictionaryInternal

Sample

Instantiation

var client = new DiscordShardedClient(
	new DiscordSocketConfig
	{
		GatewayIntents =
			GatewayIntents.GuildMessages
			| GatewayIntents.DirectMessages
			| GatewayIntents.Guilds
			| GatewayIntents.MessageContent,
		LogGatewayIntentWarnings = false,
		TotalShards = 10,
		LogLevel = LogSeverity.Debug,
	}
)

Packages

N/A

Issue Analytics

  • State:open
  • Created 2 months ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
nikita-petkocommented, Aug 1, 2023

Reopening as a new error has been encounted, after this error it will continously throw this error. It may be occuring in the GuildDownloader, but it also happens on my other test. After the 6th or 7th shard it will always throw this error.

[2023-08-01T03:43:27.3327Z][0029][][KVEX-WIN-234][bot][ERROR] DiscordInternal-EXCEPTION-Shard #6:
Error Type: System.TimeoutException
Error Detail: The operation has timed out.
Inner Exception:
Exception Stack Trace:
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Discord.ConnectionManager.<WaitAsync>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Discord.WebSocket.DiscordSocketClient.<OnConnectingAsync>d__118.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Discord.ConnectionManager.<ConnectAsync>d__31.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Discord.ConnectionManager.<>c__DisplayClass29_0.<<StartAsync>b__0>d.MoveNext()
Exception Source: mscorlib
Exception TargetSite: Void Throw()
Exception Data: System.Collections.ListDictionaryInternal
0reactions
nikita-petkocommented, Aug 2, 2023

Same but with 6 shards and over:

@DeclanFrampton this is the full exception on a debug build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shards With Unavailable Guilds Not Starting · Issue #3956 ...
This issue is persistent across all versions of djs, including 12. The timeout happens around 90% of the time I start the shards....
Read more >
Block delete times out for blocks created of very large size
Timeouts resulted in failed deletions and stale shards remaining in the .shard directory. Shard deletion is now a background process that deletes one...
Read more >
ES 6.x - Timeout by REST API operations - Elasticsearch
I've got about 30 indices for the data I ingest each with 5 primary shards and 5 replica shards (now that I set...
Read more >
MongoDB balancer timeout with delayed replica
We have a setup of two mongodb shards. Each shard contains a master, a slave, a 24h slave delay slave and an arbiter....
Read more >
Failed to update shard information for ...
This guide will help you check for common problems that cause the log “Failed to update shard information for ClusterInfoUpdateJob within 15s timeout”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found