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

Likely Unity's fault: "Only one usage of each socket address (protocol/network address/port) is normally permitted" #82

Open
megalithos opened this issue Dec 7, 2022 · 5 comments
Labels
Bug Something isn't working More Info Required Further information is required Unity This issue or pull request is specific to Unity

Comments

@megalithos
Copy link

Yes, I submitted the same issue before.

I don't know how to reproduce, I get the issue after some time when I have stopped and started play mode in unity editor multiple times. It gets fixed when I restart the unity editor.

@tom-weiland tom-weiland added the Bug Something isn't working label Jan 16, 2023
@tom-weiland
Copy link
Collaborator

#53 was the previous issue (just for reference).

I had someone else complain about this same error on Discord just the other day. It's caused by the socket not being shut down correctly (even though—as far as I know—it should be when calling Server.Stop in OnApplicationQuit), and restarting the editor fixes it because that cleans it all up.

I myself haven't run into this error in several months, which makes debugging it virtually impossible. Any additional information about in which scenarios/what you were doing when the error occurs would be extremely helpful, particularly if you notice any patterns.

Even just putting a Debug.Log line after the Server.Stop call to confirm that it's running when you get the error would be a good start.

@tom-weiland tom-weiland added the More Info Required Further information is required label Feb 25, 2023
@megalithos
Copy link
Author

I have a bit more info: my friend is making rpg with unity and he gets the same error with Mirror networking solution. He also fixes it just by restarting Unity.

@tom-weiland
Copy link
Collaborator

That's helpful to know, but still isn't definitive—either Mirror has the same problem or something about the Unity editor prevents it from shutting sockets down properly...

The last time I personally ran into this (months and months ago), I think it may have been after making code changes while the editor was in play mode. Perhaps when Unity rebuilds/reloads the code it either messes with running sockets or prevents the shutdown code from running? That was a long time ago and may have just been a one-off though, so if anyone else can provide more context regarding the conditions/timing/circumstances of this error, that'd be a big help.

@megalithos
Copy link
Author

Yeah that sounds like a valid theory.
My guess is that the bug happens with some chance (like 0,1% chance) (lol) when the code is edited & unity is stopped while it is running like you said. So it would be internal bug in unity itself.

@tom-weiland
Copy link
Collaborator

when the code is edited & unity is stopped while it is running

Yeah, I've noticed it happening under those circumstances, but I can't confirm that that's the only time it happens :/

@tom-weiland tom-weiland changed the title "only one socket address is normally permitted" Likely Unity's fault: "Only one usage of each socket address (protocol/network address/port) is normally permitted" Nov 22, 2023
@tom-weiland tom-weiland added the Unity This issue or pull request is specific to Unity label Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working More Info Required Further information is required Unity This issue or pull request is specific to Unity
Projects
None yet
Development

No branches or pull requests

2 participants