Skip to content

fit python: Address already in use #263

@mikeaaaaaa

Description

@mikeaaaaaa

问题摘要 / Issue Summary

python fit 启动报错

版本信息 / Version Information

v3.5.0-M6

浏览器 / Browser

其他 (请在下方说明) / Other (please specify below)

操作系统 / Operating System

macOS (Apple Silicon)

发生了什么?/ What happened?

从官网clone的python fit,仅在 registry_client插件的配置文件中修改了注册中心地址,其余都是默认配置。fit-framework/framework/fit/python/fitframework 目录下启动报错:
2025-08-26 19:16:10,241 - broker_utils:115 - [WARNING] - user exception type: <class 'OSError'> - [MainThread]
2025-08-26 19:16:10,241 - broker_utils:116 - [WARNING] - user exception value: [Errno 48] Address already in use - [MainThread]
2025-08-26 19:16:10,246 - broker_utils:117 - [WARNING] - user exception trace back:
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 104, in wrapper
return _execute(*args, **kws)
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 89, in wrapper
return _execute(*args, **kws)
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 139, in fit_lb_and_execute
return broker.fit_execute(address, generic_id, fitable_id, fit_ref, *args, timeout=timeout,
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/trace.py", line 211, in wrapper
return broker_execute(*args, **kwargs)
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/configure_based_brokerimpl.py", line 362, in fit_execute
return address(*args)
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/plugin/fit_py_server_http/http_server.py", line 43, in server_start
init_fit_http_server(port_to_listen)
File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/plugin/fit_py_server_http/fit_http_server.py", line 279, in init_fit_http_server
_http_server.listen(port)
File "/Users/xiaohao/Project/java/fit-framework/framework/fit/python/venv/lib/python3.9/site-packages/tornado/tcpserver.py", line 183, in listen
sockets = bind_sockets(
File "/Users/xiaohao/Project/java/fit-framework/framework/fit/python/venv/lib/python3.9/site-packages/tornado/netutil.py", line 162, in bind_sockets
sock.bind(sockaddr)

  • [MainThread]
    2025-08-26 19:16:10,246 - broker_utils:141 - [ERROR] - non-degradable fit exception found: [Errno 48] Address already in use - [MainThread]
    2025-08-26 19:16:10,246 - broker_utils:108 - [WARNING] - fit invoke error with fitable info (d087020c54ea44e3a8a893e5fbc2959e:ed770dde7be44cf18fe0ebe2fc7a773d): [Errno 48] Address already in use - [MainThread]
    2025-08-26 19:16:10,246 - broker_utils:141 - [ERROR] - non-degradable fit exception found: [Errno 48] Address already in use - [MainThread]
    booting failed, terminating
    Traceback (most recent call last):
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/api/decorators.py", line 365, in wrapper
    return func(*args, **kw)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/api/decorators.py", line 349, in wrapper
    ret = func(*args, **kw)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/init.py", line 203, in main
    bootstrap_start(plugins_info, runtime_context.get_item(const.CONFIG_FOLDER_ARG_NAME))
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/api/decorators.py", line 411, in wrapper
    ret = func(*args, **kw)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/api/decorators.py", line 52, in fit_invoke_wrapper
    return select_broker.select(generic_id)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/select_broker.py", line 119, in fit_selector_invoke
    return self.broker.fit_ffp_invoke(self._genericable_id, self._fitable_identifier, fit_ref,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 48, in fit_ffp_invoke
    raise err from None
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 37, in fit_ffp_invoke
    result = self.fit_invoke(generic_id, fitable_identifier, fit_ref, *args, timeout=timeout, is_async=is_async,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 148, in fit_invoke
    return fit_lb_and_execute(self, generic_id, the_id, fit_ref, *args, timeout=timeout, is_async=is_async,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 129, in wrapper
    return _execute(broker, generic_id, cur_fitable_id, fit_ref, *fit_args, **fit_kws)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 104, in wrapper
    return _execute(*args, **kws)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 89, in wrapper
    return _execute(*args, **kws)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 139, in fit_lb_and_execute
    return broker.fit_execute(address, generic_id, fitable_id, fit_ref, *args, timeout=timeout,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/simple_brokerimpl.py", line 38, in fit_execute
    return address(*args)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/bootstrap/fit_py_bootstrap/bootstrap.py", line 103, in start
    _start_all_servers()
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/api/decorators.py", line 411, in wrapper
    ret = func(*args, **kw)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/bootstrap/fit_py_bootstrap/bootstrap.py", line 160, in _start_all_servers
    select(const.FIT_SERVER_START_GEN_ID).route_filter(_start_server_fitable_exists).fit_selector_invoke()
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/select_broker.py", line 119, in fit_selector_invoke
    return self.broker.fit_ffp_invoke(self._genericable_id, self._fitable_identifier, fit_ref,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 48, in fit_ffp_invoke
    raise err from None
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 37, in fit_ffp_invoke
    result = self.fit_invoke(generic_id, fitable_identifier, fit_ref, *args, timeout=timeout, is_async=is_async,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 148, in fit_invoke
    return fit_lb_and_execute(self, generic_id, the_id, fit_ref, *args, timeout=timeout, is_async=is_async,
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 129, in wrapper
    return _execute(broker, generic_id, cur_fitable_id, fit_ref, *fit_args, **fit_kws)
    File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 118, in wrapper
    raise FitException(InternalErrorCode.EXCEPTION_FROM_USER_CODE_OCCURRED.value,
    fitframework.core.exception.fit_exception.FitException: [Errno 48] Address already in use
    2025-08-26 19:16:10,248 - decorators:371 - [ERROR] - [Errno 48] Address already in use.

期望的行为 / Expected Behavior

不期望看到报错

重现步骤 / Steps to Reproduce

直接启动python版的fit框架即可看到错误

相关日志 / Relevant Logs

2025-08-26 19:16:10,205 - load_module:77  - [INFO] - plugins of level 4 loaded successfully - [MainThread]
2025-08-26 19:16:10,237 - service_db_registered:94  - [INFO] - register format: JSON - [MainThread]
2025-08-26 19:16:10,237 - service_db_registered:94  - [INFO] - register format: CBOR - [MainThread]
2025-08-26 19:16:10,238 - service_db_registered:35  - [INFO] - register HTTP server - [MainThread]
2025-08-26 19:16:10,241 - broker_utils:115 - [WARNING] - user exception type: <class 'OSError'> - [MainThread]
2025-08-26 19:16:10,241 - broker_utils:116 - [WARNING] - user exception value: [Errno 48] Address already in use - [MainThread]
2025-08-26 19:16:10,246 - broker_utils:117 - [WARNING] - user exception trace back:
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 104, in wrapper
    return _execute(*args, **kws)
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker_utils.py", line 89, in wrapper
    return _execute(*args, **kws)
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/broker.py", line 139, in fit_lb_and_execute
    return broker.fit_execute(address, generic_id, fitable_id, fit_ref, *args, timeout=timeout,
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/trace.py", line 211, in wrapper
    return broker_execute(*args, **kwargs)
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/fitframework/core/broker/configure_based_brokerimpl.py", line 362, in fit_execute
    return address(*args)
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/plugin/fit_py_server_http/http_server.py", line 43, in server_start
    init_fit_http_server(port_to_listen)
  File "/Users/xiaohao/Project/python/fit-framework/framework/fit/python/plugin/fit_py_server_http/fit_http_server.py", line 279, in init_fit_http_server
    _http_server.listen(port)
  File "/Users/xiaohao/Project/java/fit-framework/framework/fit/python/venv/lib/python3.9/site-packages/tornado/tcpserver.py", line 183, in listen
    sockets = bind_sockets(
  File "/Users/xiaohao/Project/java/fit-framework/framework/fit/python/venv/lib/python3.9/site-packages/tornado/netutil.py", line 162, in bind_sockets
    sock.bind(sockaddr)
 - [MainThread]
2025-08-26 19:16:10,246 - broker_utils:141 - [ERROR] - non-degradable fit exception found: [Errno 48] Address already in use - [MainThread]
2025-08-26 19:16:10,246 - broker_utils:108 - [WARNING] - fit invoke error with fitable info (d087020c54ea44e3a8a893e5fbc2959e:ed770dde7be44cf18fe0ebe2fc7a773d): [Errno 48] Address already in use - [MainThread]
2025-08-26 19:16:10,246 - broker_utils:141 - [ERROR] - non-degradable fit exception found: [Errno 48] Address already in use - [MainThread]
2025-08-26 19:16:10,248 - runtime:48  - [INFO] - runtime plugin shutdown - [MainThread]
2025-08-26 19:16:10,248 - eventing:48  - [WARNING] - try to fitframework.utils.scheduler._stop failed, <class 'AttributeError'>possibly caused by an interruption. skipped. - [MainThread]
2025-08-26 19:16:10,248 - http_server:66  - [INFO] - prepare to stop all http and https server. - [MainThread]
2025-08-26 19:16:10,248 - fit_http_server:319 - [INFO] - http server stopped. - [MainThread]
2025-08-26 19:16:10,249 - fit_http_server:321 - [INFO] - IOLoop stopped. - [MainThread]
2025-08-26 19:16:10,249 - fit_http_server:323 - [INFO] - _executor shut down. - [MainThread]
2025-08-26 19:16:10,249 - http_server:68  - [INFO] - all http and https server stopped. - [MainThread]
2025-08-26 19:16:10,249 - runtime:60  - [INFO] - all services have been off. main thread exiting... - [MainThread]
2025-08-26 19:16:10,989 - heart_beat_agent:130 - [ERROR] - heart beat job is not alive, runtime should shutdown immediately. - [HeartBeatWatchThread]
2025-08-26 19:16:10,990 - runtime:48  - [INFO] - runtime plugin shutdown - [HeartBeatWatchThread]
2025-08-26 19:16:10,992 - heart_beat_agent:153 - [INFO] - heart beat agent offline - [HeartBeatWatchThread]
2025-08-26 19:16:10,992 - eventing:48  - [WARNING] - try to fitframework.utils.scheduler._stop failed, <class 'AttributeError'>possibly caused by an interruption. skipped. - [HeartBeatWatchThread]
2025-08-26 19:16:10,993 - http_server:66  - [INFO] - prepare to stop all http and https server. - [HeartBeatWatchThread]
2025-08-26 19:16:10,993 - fit_http_server:319 - [INFO] - http server stopped. - [HeartBeatWatchThread]
2025-08-26 19:16:10,994 - fit_http_server:321 - [INFO] - IOLoop stopped. - [HeartBeatWatchThread]
2025-08-26 19:16:10,994 - fit_http_server:323 - [INFO] - _executor shut down. - [HeartBeatWatchThread]
2025-08-26 19:16:10,994 - http_server:68  - [INFO] - all http and https server stopped. - [HeartBeatWatchThread]
2025-08-26 19:16:10,994 - runtime:60  - [INFO] - all services have been off. main thread exiting... - [HeartBeatWatchThread]
2025-08-26 19:16:17,746 - runtime:48  - [INFO] - runtime plugin shutdown - [MainThread]
2025-08-26 19:16:17,746 - heart_beat_agent:153 - [INFO] - heart beat agent offline - [MainThread]
2025-08-26 19:16:17,746 - eventing:48  - [WARNING] - try to fitframework.utils.scheduler._stop failed, <class 'AttributeError'>possibly caused by an interruption. skipped. - [MainThread]
2025-08-26 19:16:17,747 - http_server:66  - [INFO] - prepare to stop all http and https server. - [MainThread]
2025-08-26 19:16:17,747 - fit_http_server:319 - [INFO] - http server stopped. - [MainThread]
2025-08-26 19:16:17,747 - fit_http_server:321 - [INFO] - IOLoop stopped. - [MainThread]
2025-08-26 19:16:17,747 - fit_http_server:323 - [INFO] - _executor shut down. - [MainThread]
2025-08-26 19:16:17,747 - http_server:68  - [INFO] - all http and https server stopped. - [MainThread]
2025-08-26 19:16:17,747 - runtime:60  - [INFO] - all services have been off. main thread exiting... - [MainThread]

额外信息 / Additional Context

No response

确认事项 / Confirmations

  • 我已经搜索了现有的issues,确认这不是重复问题
    I have searched existing issues and confirmed this is not a duplicate

  • 我已经阅读了项目文档和 FAQ
    I have read the project documentation and FAQ

  • 我提供的信息准确完整
    The information I provided is accurate and complete

  • 我愿意协助测试问题修复 (可选)
    I'm willing to help test the bug fix (optional)

Metadata

Metadata

Assignees

Labels

in: fitIssues in FIT modulestype: bugA general bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions