Splamy / TS3AudioBot

Advanced Musicbot for Teamspeak 3
https://splamy.de/TSAudioBot/Home
Open Software License 3.0
700 stars 139 forks source link

Auto start bot creates identity conflict #1033

Open DAIIIIIIIIIIIIII opened 1 year ago

DAIIIIIIIIIIIIII commented 1 year ago

Describe the bug

I downloaded the bot correctly, after understanding how it works I created a bash script that simply starts the bot. Next I created a service that would go and start the script every time I started my raspberry. But I noticed that when the bot starts, it starts in the right server room, it starts with the right user permissions, and the commands all work correctly. But the moment I go to the online site to manage the bot, I see that the bot marks it as offline, and the moment I press the button to start it, a second bot comes in, with a different (new) ts instance. In short, the problem is that the site does not detect that the bot has actually been started. Translated with www.DeepL.com/Translator (free version)

To Reproduce create a bash file that starts the TS3AudioBot executable, create a service that runs at system startup, the bash file

Version 0.12.0

Platform Raspebby pi 4 with raspberry pi os lite

Log

2023-04-30 21:23:28.2279| INFO|Core|Setup.LogHeader [============ TS3AudioBot started =============]
2023-04-30 21:23:28.4400| INFO|Core|Setup.LogHeader [ Date: Sunday, 30 April 2023 21:23:28
2023-04-30 21:23:29.0185| INFO|Core|Setup.LogHeader [ Version: 0.12.0/master/768c1867
2023-04-30 21:23:29.0185| INFO|Core|Setup.LogHeader [ Build: Release
2023-04-30 21:23:29.0185| INFO|Core|Setup.LogHeader [ Platform: Debian GNU/Linux 11 (bullseye) (64bit)
2023-04-30 21:23:29.0226| INFO|Core|Setup.LogHeader [ Runtime: .NET Framework 3.1.13 ServerGC:True GC:SustainedLowLatency
2023-04-30 21:23:29.0281| INFO|Core|Setup.LogHeader [ Opus: libopus 1.3.1 (x64)
2023-04-30 21:23:29.0281| INFO|Core|Setup.LogHeader [==============================================]
2023-04-30 21:23:32.0481| INFO|Core|WebServer.StartWebServerInternal Starting Webserver on port 58913
2023-04-30 21:23:33.6351| INFO|Core|Bot.Run Bot "default" connecting to "176.105.252.120"
2023-04-30 21:23:35.3795| WARN|Core|PacketHandler`2.SendRaw Failed to deliver packet (Err:NetworkUnreachable)
System.Net.Sockets.SocketException (101): Network is unreachable
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
   at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
   at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 size, SocketFlags socketFlags, EndPoint remoteEP)
   at TSLib.Full.PacketHandler`2.SendRaw(Packet`1& packet) in C:\projects\ts3audiobot\TSLib\Full\PacketHandler.cs:line 759
2023-04-30 21:23:35.4233| WARN|0|PacketHandler`2.ResendLoop Previous resend tick didn't finish
2023-04-30 21:23:35.5238| WARN|0|PacketHandler`2.ResendLoop Previous resend tick didn't finish
2023-04-30 21:23:35.6228| WARN|0|PacketHandler`2.ResendLoop Previous resend tick didn't finish
2023-04-30 21:23:36.0319| INFO|Core|Bot.Stop Bot (0) disconnecting.
2023-04-30 21:23:36.1345|ERROR|Core|Ts3Client.ConnectClient Could not connect: custom_error: the command failed to execute: Socket send error

and 10 seconds later

2023-04-30 21:23:40.0107| INFO|Core|Setup.LogHeader [============ TS3AudioBot started =============]
2023-04-30 21:23:40.3562| INFO|Core|Setup.LogHeader [ Date: Sunday, 30 April 2023 21:23:40
2023-04-30 21:23:41.2176| INFO|Core|Setup.LogHeader [ Version: 0.12.0/master/768c1867
2023-04-30 21:23:41.2195| INFO|Core|Setup.LogHeader [ Build: Release
2023-04-30 21:23:41.2195| INFO|Core|Setup.LogHeader [ Platform: Debian GNU/Linux 11 (bullseye) (64bit)
2023-04-30 21:23:41.2235| INFO|Core|Setup.LogHeader [ Runtime: .NET Framework 3.1.13 ServerGC:True GC:SustainedLowLatency
2023-04-30 21:23:41.2279| INFO|Core|Setup.LogHeader [ Opus: libopus 1.3.1 (x64)
2023-04-30 21:23:41.2279| INFO|Core|Setup.LogHeader [==============================================]
2023-04-30 21:23:45.7799| INFO|Core|WebServer.StartWebServerInternal Starting Webserver on port 58913
2023-04-30 21:23:46.8673| INFO|Core|WebServer.OnShutdown WebServer has closed
2023-04-30 21:23:46.9044|ERROR|Core|WebServer.StartWebServerInternal The webserver could not be started
System.IO.IOException: Failed to bind to address http://[::]:58913: address already in use.
 ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
 ---> System.Net.Sockets.SocketException (98): Address already in use
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransport.BindAsync()
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<>c__DisplayClass21_0`1.<<StartAsync>g__OnBind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context)
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindEndpointAsync(ListenOptions endpoint, AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.ListenOptions.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.AnyIPListenOptions.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.EndpointsStrategy.BindAsync(AddressBindContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.BindAsync(IServerAddressesFeature addresses, KestrelServerOptions serverOptions, ILogger logger, Func`2 createBinding)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at TS3AudioBot.Web.WebServer.<>c__DisplayClass8_0.<<StartWebServerInternal>b__7>d.MoveNext() in C:\projects\ts3audiobot\TS3AudioBot\Web\WebServer.cs:line 172
2023-04-30 21:23:48.0046| INFO|Core|Bot.Run Bot "default" connecting to "176.105.252.120"
2023-04-30 21:23:52.0731| INFO|Core|Ts3Client.ConnectClient Client connected.
qeinz commented 1 year ago

its looks liek there is already an instace of the website running,

System.IO.IOException: Failed to bind to address http://[::]:58913: address already in use. ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use ---> System.Net.Sockets.SocketException (98): Address already in use