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

[7.12.1] Exception in RESTComponent.start(): OSError:[Errno 10048] error while attempting to bind on address ('127.0.0.1', 52194) #7065

Closed
drew2a opened this issue Sep 26, 2022 · 7 comments · Fixed by #7071
Milestone

Comments

@drew2a
Copy link
Collaborator

drew2a commented Sep 26, 2022

tribler.gui.utilities.CreationTraceback: , 
  File "run_tribler.py", line 100, in <module>, 
  File "tribler\gui\start_gui.py", line 77, in run_gui, 
  File "tribler\gui\upgrade_manager.py", line 137, in on_worker_finished, 
  File "tribler\gui\utilities.py", line 411, in trackback_wrapper, 
  File "tribler\gui\core_manager.py", line 117, in start_tribler_core, 
The above exception was the direct cause of the following exception:, 
Traceback (most recent call last):, 
  File "tribler\gui\utilities.py", line 414, in trackback_wrapper, 
  File "tribler\gui\utilities.py", line 411, in trackback_wrapper, 
  File "tribler\gui\core_manager.py", line 241, in on_core_finished, 
tribler.gui.exceptions.CoreCrashedError: The Tribler core has unexpectedly finished with exit code 1 and status: 0., 
Error message: Application error, 
Last Core output:, 
> apispec\ext\marshmallow\common.py:139: UserWarning: Multiple schemas resolved to the name SpeedTestRequest. The name has been modified. Either manually add each of the schemas with a different name or provide a custom schema_name_resolver., 
> , 
> Exception in RESTComponent.start(): OSError:[Errno 10048] error while attempting to bind on address ('127.0.0.1', 52194): only one usage of each socket address (protocol/network address/port) is normally permitted, 
> [PID:4548] 2022-09-26 09:32:48,723 - ERROR <base:233> RESTComponent.start(): Exception in RESTComponent.start(): OSError:[Errno 10048] error while attempting to bind on address ('127.0.0.1', 52194): only one usage of each socket address (protocol/network address/port) is normally permitted, 
> Traceback (most recent call last):, 
>   File "tribler\core\components\base.py", line 224, in start, 
>   File "tribler\core\components\restapi\restapi_component.py", line 128, in run, 
>   File "tribler\core\components\restapi\rest\rest_manager.py", line 129, in start, 
>   File "aiohttp\web_runner.py", line 121, in start, 
>   File "asyncio\base_events.py", line 1463, in create_server, 
> OSError: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 52194): only one usage of each socket address (protocol/network address/port) is normally permitted[PID:4548] 2022-09-26 09:32:48,770 - ERROR <exception_handler:93> CoreExceptionHandler.unhandled_error_observer(): Unhandled exception occurred! [Errno 10048] error while attempting to bind on address ('127.0.0.1', 52194): only one usage of each socket address (protocol/network address/port) is normally permitted, 
> Traceback (most recent call last):, 
>   File "tribler\core\components\base.py", line 224, in start, 
>   File "tribler\core\components\restapi\restapi_component.py", line 128, in run, 
>   File "tribler\core\components\restapi\rest\rest_manager.py", line 129, in start, 
>   File "aiohttp\web_runner.py", line 121, in start, 
>   File "asyncio\base_events.py", line 1463, in create_server, 
> OSError: [Errno 10048] error while attempting to bind on address ('127.0.0.1', 52194): only one usage of each socket address (protocol/network address/port) is normally permittedSentry is attempting to send 1 pending error messages, 
> Waiting up to 2 seconds, 
> Press Ctrl-Break to quit
@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-T0

@drew2a
Copy link
Collaborator Author

drew2a commented Sep 27, 2022

I think we have to postpone the fix until 7.13.0.

My guess is NetworkUtils.is_port_free can work wrong in some rare cases.

ref: https://gist.github.com/geertj/4325783

@xoriole
Copy link
Contributor

xoriole commented Sep 28, 2022

On this issue regarding the occupied port, a few pointers which we have talked about earlier in some form:

  1. Regarding the ports to use, it would be better to choose the ports that are not used by outgoing ports so in the range of [>1024, <32768]. eg. 20100, 21000.

List of ports and the common programs that are using them: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

  1. Letting the core choose any free port and communicate that back to the GUI would prevent the conflict but this will require changes to the current startup process. This will not fix the issue if the issue is caused by bug (or implementation) in NetworkUtils.is_port_free.

@drew2a
Copy link
Collaborator Author

drew2a commented Oct 28, 2022

What if we introduce session_config.conf that generates from the normal config and is valid for the current Tribler run only?

The sequence of Tribler run then will be the following:

  1. Run Tribler GUI
  2. Run Tribler Core
  3. Tribler Core opens all necessary ports and puts them into the session_config.conf (derived from the triblerd.conf).
  4. Tribler GUI waits for the session_config.conf to be created
  5. Tribler GUI connects to the core by using the port from the session_config.conf

@sentry-for-tribler
Copy link

sentry-for-tribler bot commented Jun 9, 2023

Sentry issue: TRIBLER-180

Occured in 7.13.0-RC1

@drew2a drew2a reopened this Jun 9, 2023
@xoriole xoriole removed their assignment Jun 16, 2023
@xoriole
Copy link
Contributor

xoriole commented Jun 16, 2023

@kozlovsky Does your last fix on the core already running issue fix this as well?

@kozlovsky
Copy link
Collaborator

@xoriole It should be fixed by #7461 in 7.13.0-RC3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants