Skip to content
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

Bot disconnects itself after a while #11

Closed
Outpox opened this issue Oct 15, 2018 · 11 comments
Closed

Bot disconnects itself after a while #11

Outpox opened this issue Oct 15, 2018 · 11 comments
Labels
bug Something isn't working

Comments

@Outpox
Copy link

Outpox commented Oct 15, 2018

Hey there, it's been a while.

I'm having issues with the bot disconnecting itself for no reason after some time of inactivity.
I'm currently running it inside a tmux session on a dedicated server on Debian 8 but the same issue occurs with Docker.

These are the only logs I've got for the bot, and as you can see it's supposed to have been running for 12 days.

▶ dart bin/main.dart
[FINE]  {CommandsFramework} - 3.10.2018 15:12:45:734 -- Command [mp] has been registered
[FINE]  {CommandsFramework} - 3.10.2018 15:12:45:745 -- Command [game] has been registered
[FINE]  {CommandsFramework} - 3.10.2018 15:12:45:746 -- Command [player] has been registered
[FINE]  {CommandsFramework} - 3.10.2018 15:12:45:747 -- Command [update] has been registered
[FINE]  {CommandsFramework} - 3.10.2018 15:12:45:748 -- Command [doodle] has been registered
[INFO]  {Client} - 3.10.2018 15:12:47:125 -- Connected and ready!
Ready!

However it's unresponsive to commands and is logged off

image

Do you have any idea or suggestion?

@l7ssha
Copy link
Member

l7ssha commented Oct 15, 2018

Bot cannot disconnect itself or something like that. Maybe your server suspends bot process. I have bot running correctly for 24h and another for 18h. Can you setup some message logging, or/and periodic timer to print if program is running.

For ex:

Timer.periodic(const Duration(minute: 1), (t) => print(bot.guilds.count));

EDIT:
Also please update your script to latest nyxx and provide shards, guilds and users count.

@Outpox
Copy link
Author

Outpox commented Oct 15, 2018

I'm going to add some periodic logging and will get back to you, thanks.

@Outpox
Copy link
Author

Outpox commented Oct 15, 2018

I don't understand, I've had the process opened in a terminal the whole time, it kept printing to the console but the bot still went offline.

▶ dart bin/main.dart
[FINE]  {CommandsFramework} - 15.10.2018 10:29:38:234 -- Command [mp] has been registered
[FINE]  {CommandsFramework} - 15.10.2018 10:29:38:245 -- Command [game] has been registered
[FINE]  {CommandsFramework} - 15.10.2018 10:29:38:247 -- Command [player] has been registered
[FINE]  {CommandsFramework} - 15.10.2018 10:29:38:248 -- Command [update] has been registered
[FINE]  {CommandsFramework} - 15.10.2018 10:29:38:249 -- Command [doodle] has been registered
[INFO]  {Client} - 15.10.2018 10:29:39:781 -- Connected and ready!
Ready!
2018-10-15 10:44:38.310004 still alive?
2018-10-15 10:59:38.309588 still alive?
2018-10-15 11:14:38.309594 still alive?
2018-10-15 11:29:38.309588 still alive?
2018-10-15 11:44:38.309584 still alive?
2018-10-15 11:59:38.309579 still alive?
2018-10-15 12:14:38.309577 still alive?
2018-10-15 12:29:38.309579 still alive?
2018-10-15 12:44:38.309567 still alive?
2018-10-15 12:59:38.309564 still alive?
2018-10-15 13:14:38.309554 still alive?
2018-10-15 13:29:38.309544 still alive?
2018-10-15 13:44:38.309576 still alive?
2018-10-15 13:59:38.309557 still alive?
2018-10-15 14:14:38.309555 still alive?
2018-10-15 14:29:38.309570 still alive?

image

@l7ssha
Copy link
Member

l7ssha commented Oct 15, 2018

I found just now problems with sessions invalidating right after READY event.
Can you create listener to onDisconnect event? Please provide info with close code and shard number.

@Outpox
Copy link
Author

Outpox commented Oct 15, 2018

I will do that later today yes ;-)

@l7ssha
Copy link
Member

l7ssha commented Oct 15, 2018

Are you setting presence for your bot? Gateway disconnects me due invalid opcode when sending STATUS_UPDATE.

But bot shouldn't be disconnected due we don't have any message.

@Outpox
Copy link
Author

Outpox commented Oct 15, 2018

Nope, I'm not setting the bot's presence. I'll have a look on how to set it.

@l7ssha
Copy link
Member

l7ssha commented Oct 15, 2018

Pushed possibly fix for this problem. Please test against latest commit.

@l7ssha l7ssha added the bug Something isn't working label Oct 15, 2018
@Outpox
Copy link
Author

Outpox commented Oct 15, 2018

I've update my code for the newest Nyxx version and it seems to be working on my local machine. I'll run it tonight on my server and will let you know ;-)

@l7ssha l7ssha added the working label Oct 15, 2018
@Outpox
Copy link
Author

Outpox commented Oct 16, 2018

The bot is still connected and responsive to commands (12h uptime) so I'd say it looks promising!
I don't know if it's relevant to you but I've had the following log several times:

UNKNOWN OPCODE: {"t":"GUILD_INTEGRATIONS_UPDATE","s":2577,"op":0,"d":{"guild_id":"450704289141358607"}}

@l7ssha
Copy link
Member

l7ssha commented Oct 16, 2018

That's okay - ignore it. I'm just logging these to notice about them.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants