You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
from pymongo import AsyncMongoClient
from beanie import init_beanie
from utils.logger import logger
from modules.users.models import User, BlacklistEntry, LoginHistory, UserWorkExperience, UserEducationExperience
from modules.dicts.models import DictType, DictItem
from modules.colors.models import Color
from modules.files.models import FileRecord
from modules.avatars.models import Avatar
from modules.logs.models import OperationLog
from modules.navigation.models import NavGroup, NavCard, UserNavConfig, HotLink
from modules.messages.models import Message
from modules.announcements.models import Announcement
from modules.notifications.models import Notification
from modules.blog.models import BlogCategory, BlogTag, BlogColumn, BlogArticle, BlogArticleContent, BlogComment,
BlogLike, BlogFavorite, UserFollow, ColumnFollow
from modules.schedule.models import Schedule
from modules.page_config.models import PageConfig
`
Main 23:04:58 DEBUG: Creating multiprocessing context using 'spawn'
Main 23:04:58 DEBUG: Starting a process: Sanic-Server-0-0
Main 23:04:58 DEBUG: Starting a process: Sanic-Reloader-0
D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\server\loop.py:62: DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16
asyncio.get_event_loop_policy(), asyncio.WindowsSelectorEventLoopPolicy
D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\server\loop.py:62: DeprecationWarning: 'asyncio.WindowsSelectorEventLoopPolicy' is deprecated and slated for removal in Python 3.16
asyncio.get_event_loop_policy(), asyncio.WindowsSelectorEventLoopPolicy
D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\server\loop.py:64: DeprecationWarning: 'asyncio.set_event_loop_policy' is deprecated and slated for removal in Python 3.16
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
2025-12-28 23:04:59,701 INFO sanicpro2 database init_db:30 正在连接MongoDB(分字段)
2025-12-28 23:04:59,707 INFO sanicpro2 database init_db:53 MongoDB连接成功,开始初始化数据库
Executing <Task pending name='Task-2' coro=<Sanic._server_event() running at D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\app.py:2443> wait_for=<Future pending cb=[Task.task_wakeup()] created at C:\Users\ggg\AppData\Roaming\uv\python\cpython-3.14.0-windows-x86_64-none\Lib\asyncio\base_events.py:459> cb=[_run_until_complete_cb() at C:\Users\ggg\AppData\Roaming\uv\python\cpython-3.14.0-windows-x86_64-none\Lib\asyncio\base_events.py:181] created at C:\Users\ggg\AppData\Roaming\uv\python\cpython-3.14.0-windows-x86_64-none\Lib\asyncio\tasks.py:732> took 0.834 seconds
Main 23:05:31 ERROR: Not all workers acknowledged a successful startup. Shutting down.
It seems that one or more of your workers failed to come online in the allowed time. Sanic is shutting down to avoid a deadlock. The current threshold is 30.0s. If this problem persists, please check out the documentation https://sanic.dev/en/guide/deployment/manager.html#worker-ack.
Main 23:05:31 INFO: Killing Sanic-Server-0-0 [14460]
Main 23:05:31 ERROR: Experienced exception while trying to serve
Traceback (most recent call last):
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\mixins\startup.py", line 1141, in serve
manager.run()
~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 195, in run
self.monitor()
~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 292, in monitor
self.wait_for_ack()
~~~~~~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 339, in wait_for_ack
self.kill()
~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 376, in kill
os.killpg(os.getpgid(process.pid), SIGKILL)
^^^^^^^^^
AttributeError: module 'os' has no attribute 'killpg'. Did you mean: 'kill'?
Main 23:05:31 INFO: Server Stopped
Main 23:05:41 WARN: Worker shutdown timed out. Some processes may still be running.
Main 23:05:41 DEBUG: じゃね
Traceback (most recent call last):
File "D:\projects\多合一\backendServer\sanicpro2\main.py", line 17, in
main()
~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2\main.py", line 11, in main
app.run(host=config.HOST, port=config.PORT, debug=config.DEBUG, auto_reload=True, workers=1)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\mixins\startup.py", line 282, in run
serve(primary=self) # type: ignore
~~~~~^^^^^^^^^^^^^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\mixins\startup.py", line 1141, in serve
manager.run()
~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 195, in run
self.monitor()
~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 292, in monitor
self.wait_for_ack()
~~~~~~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 339, in wait_for_ack
self.kill()
~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 376, in kill
os.killpg(os.getpgid(process.pid), SIGKILL)
^^^^^^^^^
AttributeError: module 'os' has no attribute 'killpg'. Did you mean: 'kill'?
`
init_beanie 很长时间不回复,导致sanic启动失败
init_beanie has not replied for a long time, resulting in the failure of Sanic startup
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
`
from pymongo import AsyncMongoClient
from beanie import init_beanie
from utils.logger import logger
from modules.users.models import User, BlacklistEntry, LoginHistory, UserWorkExperience, UserEducationExperience
from modules.dicts.models import DictType, DictItem
from modules.colors.models import Color
from modules.files.models import FileRecord
from modules.avatars.models import Avatar
from modules.logs.models import OperationLog
from modules.navigation.models import NavGroup, NavCard, UserNavConfig, HotLink
from modules.messages.models import Message
from modules.announcements.models import Announcement
from modules.notifications.models import Notification
from modules.blog.models import BlogCategory, BlogTag, BlogColumn, BlogArticle, BlogArticleContent, BlogComment,
BlogLike, BlogFavorite, UserFollow, ColumnFollow
from modules.schedule.models import Schedule
from modules.page_config.models import PageConfig
async def init_db(app):
try:
host = app.config.get("MONGODB_HOST")
port = app.config.get("MONGODB_PORT")
username = app.config.get("MONGODB_USERNAME")
password = app.config.get("MONGODB_PASSWORD")
tls = app.config.get("MONGODB_TLS")
db_name = app.config.get("MONGODB_DATABASE") or "sanicpro2"
async def close_db(app):
client = getattr(app.ctx, "mongo_client", None)
if client:
logger.info("正在关闭MongoDB连接")
client.close()
logger.info("MongoDB连接已关闭")
`
`
Main 23:04:58 DEBUG: Creating multiprocessing context using 'spawn'
Main 23:04:58 DEBUG: Starting a process: Sanic-Server-0-0
Main 23:04:58 DEBUG: Starting a process: Sanic-Reloader-0
D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\server\loop.py:62: DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16
asyncio.get_event_loop_policy(), asyncio.WindowsSelectorEventLoopPolicy
D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\server\loop.py:62: DeprecationWarning: 'asyncio.WindowsSelectorEventLoopPolicy' is deprecated and slated for removal in Python 3.16
asyncio.get_event_loop_policy(), asyncio.WindowsSelectorEventLoopPolicy
D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\server\loop.py:64: DeprecationWarning: 'asyncio.set_event_loop_policy' is deprecated and slated for removal in Python 3.16
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
2025-12-28 23:04:59,701 INFO sanicpro2 database init_db:30 正在连接MongoDB(分字段)
2025-12-28 23:04:59,707 INFO sanicpro2 database init_db:53 MongoDB连接成功,开始初始化数据库
Executing <Task pending name='Task-2' coro=<Sanic._server_event() running at D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\app.py:2443> wait_for=<Future pending cb=[Task.task_wakeup()] created at C:\Users\ggg\AppData\Roaming\uv\python\cpython-3.14.0-windows-x86_64-none\Lib\asyncio\base_events.py:459> cb=[_run_until_complete_cb() at C:\Users\ggg\AppData\Roaming\uv\python\cpython-3.14.0-windows-x86_64-none\Lib\asyncio\base_events.py:181] created at C:\Users\ggg\AppData\Roaming\uv\python\cpython-3.14.0-windows-x86_64-none\Lib\asyncio\tasks.py:732> took 0.834 seconds
Main 23:05:31 ERROR: Not all workers acknowledged a successful startup. Shutting down.
It seems that one or more of your workers failed to come online in the allowed time. Sanic is shutting down to avoid a deadlock. The current threshold is 30.0s. If this problem persists, please check out the documentation https://sanic.dev/en/guide/deployment/manager.html#worker-ack.
Main 23:05:31 INFO: Killing Sanic-Server-0-0 [14460]
Main 23:05:31 ERROR: Experienced exception while trying to serve
Traceback (most recent call last):
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\mixins\startup.py", line 1141, in serve
manager.run()
~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 195, in run
self.monitor()
~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 292, in monitor
self.wait_for_ack()
~~~~~~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 339, in wait_for_ack
self.kill()
~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 376, in kill
os.killpg(os.getpgid(process.pid), SIGKILL)
^^^^^^^^^
AttributeError: module 'os' has no attribute 'killpg'. Did you mean: 'kill'?
Main 23:05:31 INFO: Server Stopped
Main 23:05:41 WARN: Worker shutdown timed out. Some processes may still be running.
Main 23:05:41 DEBUG: じゃね
Traceback (most recent call last):
File "D:\projects\多合一\backendServer\sanicpro2\main.py", line 17, in
main()
~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2\main.py", line 11, in main
app.run(host=config.HOST, port=config.PORT, debug=config.DEBUG, auto_reload=True, workers=1)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\mixins\startup.py", line 282, in run
serve(primary=self) # type: ignore
~~~~~^^^^^^^^^^^^^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\mixins\startup.py", line 1141, in serve
manager.run()
~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 195, in run
self.monitor()
~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 292, in monitor
self.wait_for_ack()
~~~~~~~~~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 339, in wait_for_ack
self.kill()
~~~~~~~~~^^
File "D:\projects\多合一\backendServer\sanicpro2.venv\Lib\site-packages\sanic\worker\manager.py", line 376, in kill
os.killpg(os.getpgid(process.pid), SIGKILL)
^^^^^^^^^
AttributeError: module 'os' has no attribute 'killpg'. Did you mean: 'kill'?
`
init_beanie 很长时间不回复,导致sanic启动失败
init_beanie has not replied for a long time, resulting in the failure of Sanic startup
Beta Was this translation helpful? Give feedback.
All reactions