Connection failed: the semaphore timeout has expired
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
Re: Connection failed: the semaphore timeout has expired
Even if we set it to a not very small value so it fixes the problem only for some clients, that'd still be valuable. I suggested it because it's something we can implement without waiting for 1.14.6.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Connection failed: the semaphore timeout has expired
The problem with using SO_KEEPALIVE is the "client" referred to earlier is the computer on which the TCP socket option is set. The values (time, interval and probes) are system-wide.
So, yes, we could set SO_KEEPALIVE on the server (wesnothd) and we could even adjust the parameters to be unreasonably small on the BfW official MP server. Even if this works for the OP, it seems a fragile and wasteful fix. (Do we really need, or even want, to send keepalives out EVERY player's connection every second or two because ONE player's network has problems with the default 60-second interval?)
My feeling is that the OP's router/modem is doing NAT and has a very short NAT keepalive value. This is one of the reasons I suggested testing on other networks. Depending on the router, the NAT timeout might be tuned to make allowance for excessive latency communicating with the MP server.
Finally, if this really is an error message from Wesnoth, someone needs to find it and replace it with something more reasonable. Sure a semaphore timed out. But if the error means that the connection to the MP server has timed out, it would probably be better to just say that.
So, yes, we could set SO_KEEPALIVE on the server (wesnothd) and we could even adjust the parameters to be unreasonably small on the BfW official MP server. Even if this works for the OP, it seems a fragile and wasteful fix. (Do we really need, or even want, to send keepalives out EVERY player's connection every second or two because ONE player's network has problems with the default 60-second interval?)
My feeling is that the OP's router/modem is doing NAT and has a very short NAT keepalive value. This is one of the reasons I suggested testing on other networks. Depending on the router, the NAT timeout might be tuned to make allowance for excessive latency communicating with the MP server.
Finally, if this really is an error message from Wesnoth, someone needs to find it and replace it with something more reasonable. Sure a semaphore timed out. But if the error means that the connection to the MP server has timed out, it would probably be better to just say that.
I forked real life and now I'm getting merge conflicts.
Re: Connection failed: the semaphore timeout has expired
But I don't really think that 10 minutes is "very short" - I suspect it's fairly common these days. My network has a timeout which is shorter than that (5 minutes). (Personally, I'm using a consumer-level network connection and hardware provided by a large ISP which likely has millions of users.)Tad_Carlucci wrote: ↑January 5th, 2019, 8:05 am My feeling is that the OP's router/modem is doing NAT and has a very short NAT keepalive value. This is one of the reasons I suggested testing on other networks. Depending on the router, the NAT timeout might be tuned to make allowance for excessive latency communicating with the MP server.
Possibly the timeout can be changed by modifying router settings, but that doesn't seem like the ideal solution to me:
- It might not be possible to change the settings
- It's not a very user-friendly solution
- It may be overkill to change the router's global settings for all connections when all you want to do is allow a single program (Wesnoth) to be able to maintain its connection to the server
ServerAliveInterval
which clients can set to prevent connections from being idle for too long.https://www.howtogeek.com/howto/linux/k ... onnecting/
While this is not a perfect solution (it requires users to manually set the setting to a value which will work for their network), it allows users to fix the issue without having to change their network's configuration.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Connection failed: the semaphore timeout has expired
I agree tweaking the router is sub-optimal and a client-software option would be better.
But I'm still thinking we're running off fixing something which may not even be the core issue.
We might be spending a lot of time 'fixing' an error which is actually something else like an equipment failure at the OP's ISP.
But I'm still thinking we're running off fixing something which may not even be the core issue.
We might be spending a lot of time 'fixing' an error which is actually something else like an equipment failure at the OP's ISP.
I forked real life and now I'm getting merge conflicts.
Re: Connection failed: the semaphore timeout has expired
I can't speak for the OP, but when testing it on my own network, it certainly looks like idle connections are the crux of the issue.
For example, if I create a game, then manually prevent a connection from being idle for too long by typing
But if I try to create a game and then leave the connection idle for more than 5 minutes, then when I cancel the game I get the error:
For example, if I create a game, then manually prevent a connection from being idle for too long by typing
/q
every few minutes, then the error does not seem to occur.But if I try to create a game and then leave the connection idle for more than 5 minutes, then when I cancel the game I get the error:
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Connection failed: the semaphore timeout has expired
Assuming this is similar to the OP's issue, the question is: what is it about his network which causes this for him, when nobody else sees (or, at least, reports) the error in normal operations.
If, for instance, there is something about his network which allows him to start a game but, then, completely blocks all traffic to the established game, then no amount of keepalive messages (such as your /q invalid commands) will solve his problem. This could be something as simple as a misconfigured firewall. We don't know because the OP has given virtually NO information: just the text of error message, and that it's on two of his Windows boxes.
If, for instance, there is something about his network which allows him to start a game but, then, completely blocks all traffic to the established game, then no amount of keepalive messages (such as your /q invalid commands) will solve his problem. This could be something as simple as a misconfigured firewall. We don't know because the OP has given virtually NO information: just the text of error message, and that it's on two of his Windows boxes.
I forked real life and now I'm getting merge conflicts.
Re: Connection failed: the semaphore timeout has expired
How do we know that nobody else sees or reports this? There was a post above that shows several bugs in the bug tracker which could be related to this:Tad_Carlucci wrote: ↑January 6th, 2019, 12:09 am Assuming this is similar to the OP's issue, the question is: what is it about his network which causes this for him, when nobody else sees (or, at least, reports) the error in normal operations.
https://github.com/wesnoth/wesnoth/issues/1336 wrote:...In general, it feels like Wesnoth client is disconnected far too often...
These reports are too vague to tell exactly what is going on, but they could be seeing the same issue.https://github.com/wesnoth/wesnoth/issues/1520 wrote:...It happens that a player is no more in game while others are waiting for his move (i.e.network disconnection...
We also know two conditions under which the issue was observed:Tad_Carlucci wrote: ↑January 6th, 2019, 12:09 am If, for instance, there is something about his network which allows him to start a game but, then, completely blocks all traffic to the established game, then no amount of keepalive messages (such as your /q invalid commands) will solve his problem. This could be something as simple as a misconfigured firewall. We don't know because the OP has given virtually NO information: just the text of error message, and that it's on two of his Windows boxes.
- After creating a new game and waiting for somebody to join for ten minutes
- While playing a multiplayer scenario and nobody makes a move for about ten minutes
In those two situations - is there any network traffic occurring between the client and the server?
Re: Connection failed: the semaphore timeout has expired
Great! I saw your screenshot and this is exactly the issue I've caught! I've to try the /q work around, it would be a good solution, but is there a way to definitely increase the idle connections timeout of my network? I had a look on my modem/router configuration but I didn't find any setting to do this.gnombat wrote: ↑January 4th, 2019, 4:55 pm I was able to reproduce this on my machine/network: I created a game on the multiplayer server, waited 5 minutes, then cancelled the game, then when I tried creating another game I got the message "Connection failed: The semaphore timeout period has expired".
(Note: I chose 5 minutes because I happen to know that is the timeout for idle connections on my network.)
Just to give you some more info: I don't have my own nat at home, but I use the most common ISP in Italy: "Telecom Italia" and they have their Nat to maximize number of connections, of course it's not under my control. It means that I don't have a static ip address (like almost all other people here) but a dynamic one. To take a static ip address I should pay much more money and, at least here in Italy, nobody does that for home connections.
I also shutdown all my local firewalls and forwarded port 15000 on my router (though it shouldn't have any effect as I don't get connected to the wesnoth server using the IP address of my own LAN of course)
Thanks in advance
Re: Connection failed: the semaphore timeout has expired
Yeah, happened to me too during game.
Beheld the origins of BFW.
Max G on WIF
Rank 🌟🌟🌟🌟🌟
Max G on WIF
Rank 🌟🌟🌟🌟🌟
Re: Connection failed: the semaphore timeout has expired
FYI: I was able to work around this issue by manually sending /q every few minutes. It would be great if it will be fixed definitively, but right now I'm able atleast to play...
Thanks
Thanks
Re: Connection failed: the semaphore timeout has expired
I'm very disappointed, I get the "Connection failed: The semaphore timeout period has expired", problem so often, that I can not play anymore.
I'm annoyed that I have to reload a game like 3 or 4 times for one match.
And my play mates get irritated too.
I tried to disable the firewall, but for no avail.
I can't play, I cant watch matches, wait for players to join, and not even stick around in the lobby, with this pesky bug around.
The thing, is that it never happened before.
I'm annoyed that I have to reload a game like 3 or 4 times for one match.
And my play mates get irritated too.
I tried to disable the firewall, but for no avail.
I can't play, I cant watch matches, wait for players to join, and not even stick around in the lobby, with this pesky bug around.
The thing, is that it never happened before.
Beheld the origins of BFW.
Max G on WIF
Rank 🌟🌟🌟🌟🌟
Max G on WIF
Rank 🌟🌟🌟🌟🌟
- Pentarctagon
- Project Manager
- Posts: 5561
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Connection failed: the semaphore timeout has expired
When did it start happening?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Connection failed: the semaphore timeout has expired
Did you change your Internet service provider recently? As far as I understood the problem is that many isp (like mine) uses a Nat to maximize number of ip addresses they can sell, but with a natted client the bfw server is unable to detect it and close its connection after few minutes.
Even if you haven't changed your provider recently, they could have changed their infrastructure in the while and this could be the reason why you get this error just right now.
To survive you can manually send /q every few minutes and your connection will be kept alive.
Regards
Last edited by Ado64 on January 24th, 2019, 11:10 am, edited 2 times in total.
Re: Connection failed: the semaphore timeout has expired
I can leave my bot online so that you could message it in order for it to keep sending you message every few minutes. If there is interest, I will set it up in the evening.
Re: Connection failed: the semaphore timeout has expired
Thanks ravana but as I said there is already a workaround for this (sending /q). Now the best thing to do would be to make a server-side fix in order to manage the "keep alive" mechanism in a different way.
Thanks