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

启动Alas后是白屏。 #876

Closed
Exziro opened this issue Jan 13, 2022 · 17 comments
Closed

启动Alas后是白屏。 #876

Exziro opened this issue Jan 13, 2022 · 17 comments
Labels
bug / 缺陷 Something isn't working

Comments

@Exziro
Copy link

Exziro commented Jan 13, 2022

之前使用一直正常
按照说明进行了多次刷新但是依旧是白屏
我将文件夹删除并且重新进行了安装
但是依然是白屏状态。
想请教一下如何解决 谢谢
捕获1
捕获2

@18870
Copy link
Collaborator

18870 commented Jan 13, 2022

2022/01/17 Edit: The solution has been changed and the order of the methods mentioned in the following discussion is different from the present one, please refer to editing history.
2022/06/21 Edit: uvicorn reload was replaced with custom one, so the solution using uvicorn command is deleted.

Try the following

  1. Ctrl+R to refresh
  2. Open console.bat or cmd, Windows Powershell, run netsh winsock reset and reboot your computer
  3. Disable reload in config/deploy.yaml (EnableReload: false)
    NOT deploy/template/deploy.yaml, it's in config folder
    # Use auto update and builtin updater feature
    # This may cause problem https://github.com/LmeSzinc/AzurLaneAutoScript/issues/876
    EnableReload: true
  4. Reinstall Alas
  5. Open console.bat, run
    python gui.py
    when you see
    INFO: Uvicorn running on http://0.0.0.0:22267 (Press CTRL+C to quit)
    open http://127.0.0.1:22267 in your browser

if any exception raised in console, get the logs and report to develops here or through discord.

==================================
2022/01/17 Edit: 更换了解决方式,下面的讨论中提到的方法顺序和现在不同,请参考编辑历史。
2022/06/21 Edit: 不再使用 uvicorn reload,删去了使用 uvicorn 命令行直接启动的部分。

尝试以下操作

  1. Ctrl+R 刷新
  2. 打开 console.batcmd, Windows Powershell,运行命令 netsh winsock reset 并重启电脑。
  3. config/deploy.yaml 中禁用 reload (EnableReload: false)
    注意不是 deploy/template/deploy.yaml, 是 config 文件夹内的
    # Use auto update and builtin updater feature
    # This may cause problem https://github.com/LmeSzinc/AzurLaneAutoScript/issues/876
    EnableReload: true
  4. 重装 Alas
  5. 打开 console.bat 运行命令
    python gui.py
    当出现
    INFO: Uvicorn running on http://0.0.0.0:22267 (Press CTRL+C to quit)
    时在浏览器中打开 http://127.0.0.1:22267

如果启动过程中发生错误,或者启动之后仍然不能通过浏览器访问,可以在 qq 群或者这个 issue 里发送错误日志。

@Exziro
Copy link
Author

Exziro commented Jan 13, 2022

请教一下 “4.在 deploy.yaml 中更换一个端口”这个 是文件里的WeBuiPort:22267这个参数么?
如果是的话请问一般改成什么比较好?我尝试改成了3000但是还依然是白屏。
其它操作全部有尝试但结果并没有什么好的效果。可以的话还能提供一些操作么?

@18870
Copy link
Collaborator

18870 commented Jan 13, 2022

试试 WebuiHost: ::
(两个冒号::)
可能是你的localhost解析到了ipv6地址上

@StortInter
Copy link

试试 WebuiHost: :: (两个冒号::) 可能是你的localhost解析到了ipv6地址上

WebuiHost:修改为::会报错,改成[::]则不会报错

已尝试过刷新、杀进程、更换IP及端口,但是白屏问题仍然没有解决

@18870
Copy link
Collaborator

18870 commented Jan 13, 2022

Electron里的地址是 http://localhost:{port}
试试用浏览器打开 http://127.0.0.1:{port}, http://[::1]:{port}, http://localhost:{port}
app就是个浏览器而已

@StortInter
Copy link

问题解决了
重新更新依赖便可: pip install -r requirements.txt (具体参数需要按自己情况修改);或者把deploy.yaml中的InstallDependencies设为true
原因应该是缺少相关依赖导致Python进程启动失败,但是没有报错所以表现为Electron白屏(毕竟不能打开一个不存在的网页)

@Exziro
Copy link
Author

Exziro commented Jan 13, 2022

InstallDependencies我这里默认是true, 依赖的话,请问怎么看哪个依赖有问题呢?我对找github上的requirements.txt的所有依赖,没有问题。但是我这边问题依然存在。不过我在重新安装后 刷新状态栏看到这样一个问题
捕获3

@chjptc
Copy link

chjptc commented Jan 14, 2022

image
image
I have the same problem, and when I try to connect to http://localhost:{port}, it says failed to connect.
Moreover, I try to reinstall all dependencies, and it shows a warning:
WARNING: The candidate selected for download or install is a yanked version: 'wrapt' candidate (version 1.13.1 at https://files.pythonhosted.org/packages/ea/45/b1cde5fd107d2bcf7d0cc6beee0c13bec0fc9eefe8111e60fcedd67fb898/wrapt-1.13.1-cp37-cp37m-win_amd64.whl#sha256=aa637733f1d599077522f6a1f0c6c40389aa90a44cba37afcefef26f8e53d28f (from https://pypi.org/simple/wrapt/) (requires-python:!=3.0.,!=3.1.,!=3.2.,!=3.3.,!=3.4.*,>=2.7))
Reason for being yanked: On Windows and Python 2.7, sdist package would fail to install if no compiler present.
Is it the reason why I have this problem? And I try to figure out how to solve it.

@18870 18870 added the bug / 缺陷 Something isn't working label Jan 14, 2022
@Exziro
Copy link
Author

Exziro commented Jan 14, 2022

感谢 方法7不行会报一些错,方法8没有问题 可以在浏览器打开。按照方法9操作后,alas.exe打开后也正常了。

@18870
Copy link
Collaborator

18870 commented Jan 14, 2022

感谢 方法7不行会报一些错,方法8没有问题 可以在浏览器打开。按照方法9操作后,alas.exe打开后也正常了。

在启动之前确保任务管理器中杀掉所有 python.exe,alas.exe

  • 方法9是使用了旧版本,尝试切换回 master 分支看看是否还能打开 ,打不开我就坐大牢了
  • 能给出方法7的报错吗(需要先切换回master分支)
  • 使用方法7/8时如果在浏览器能打开,尝试是否能在 alas 上打开
  • 如果方法7/8正常使用,尝试用 python gui.py -d 启动

WARNING: The candidate selected for download or install is a yanked version: 'wrapt' candidate

我目测 wrapt 没有影响,应该是能装上就行

我在虚拟机里安装alas能成功打开,并不能复现这个问题

@Exziro
Copy link
Author

Exziro commented Jan 14, 2022

2022-01-14 21:52:33.444 | INFO | +---------------------------------------------+
2022-01-14 21:52:33.460 | INFO | |                    START                    |
2022-01-14 21:52:33.460 | INFO | +---------------------------------------------+
2022-01-14 21:52:34.366 | INFO | <<< WEBUI CONFIGS >>>
2022-01-14 21:52:34.366 | INFO | [Theme] default
2022-01-14 21:52:34.366 | INFO | [Language] zh-CN
2022-01-14 21:52:34.366 | INFO | [Password] False
2022-01-14 21:52:34.366 | INFO | [CDN] False
INFO :     Started server process [1568]
INFO :     Waiting for application startup.
read: ./module/config/argument/menu.json
read: ./module/config/argument/args.json
read: ./module/config/i18n\zh-CN.json
read: ./module/config/i18n\en-US.json
read: ./module/config/i18n\ja-JP.json
read: ./module/config/i18n\zh-TW.json
2022-01-14 21:52:34.600 | INFO | Add task <check_update (delay=300)>
2022-01-14 21:52:34.600 | INFO | Add task <schedule_restart (delay=86400)>
2022-01-14 21:52:34.600 | INFO | Start task handler
2022-01-14 21:52:34.600 | INFO | <<< RESTART ALAS >>>
2022-01-14 21:52:34.600 | INFO | Start alas complete
INFO :     Application startup complete.
"E:/AlasApp_0.3.3/AlasApp_0.3.5/AzurLaneAutoScript/toolkit/Git/mingw64/bin/git.exe" fetch origin master
From https://github.com/LmeSzinc/AzurLaneAutoScript
 * branch              master     -> FETCH_HEAD
[ success ]
2022-01-14 21:52:36.053 | INFO | No update
Fatal error in server handler
protocol: <uvicorn.protocols.http.httptools_impl.HttpToolsProtocol object at 0x000001A12E235C08>
transport: <_SelectorSocketTransport fd=1448 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "E:\AlasApp_0.3.3\AlasApp_0.3.5\AzurLaneAutoScript\toolkit\lib\site-packages\uvicorn\server.py", line 108, in handler
    reader, writer, server_state=self.server_state, config=config
  File "E:\AlasApp_0.3.3\AlasApp_0.3.5\AzurLaneAutoScript\toolkit\lib\site-packages\uvicorn\_handlers\http.py", line 75, in handle_http
    protocol.connection_made(transport)
  File "E:\AlasApp_0.3.3\AlasApp_0.3.5\AzurLaneAutoScript\toolkit\lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 94, in connection_made
    self.client = get_remote_addr(transport)
  File "E:\AlasApp_0.3.3\AlasApp_0.3.5\AzurLaneAutoScript\toolkit\lib\site-packages\uvicorn\protocols\utils.py", line 13, in get_remote_addr
    return (str(info[0]), int(info[1])) if isinstance(info, tuple) else None
ValueError: invalid literal for int() with base 10: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

这是用7方法出现的问题,然后访问浏览器出现的错误是127.0.0.1 未发送任何数据。
8 没有任何问题 浏览器可以打开 但是alas.exe还是白屏
尝试用你说的这个

如果方法7/8正常使用,尝试用 python gui.py -d 启动
错误也是上面7方法出现的错误。

Edit: @18870 Delete duplicate errors

@18870
Copy link
Collaborator

18870 commented Jan 14, 2022

# Use auto update and builtin updater feature
# This may cause problem https://github.com/LmeSzinc/AzurLaneAutoScript/issues/876
EnableReload: true

在 deploy.yaml 里添加了一个选项禁用 reload,启动一次 alas 后会生成。改成 false 试试

出现错误是在你用浏览器连接的时候出现的还是运行之后立刻出现

@18870
Copy link
Collaborator

18870 commented Jan 14, 2022

试试这个
nonebot/nonebot2#20 (comment)

使用命令重置winsock目录后正常,应该是个例了……
netsh winsock reset

@Exziro
Copy link
Author

Exziro commented Jan 15, 2022

出现错误是在使用命令后,再使用浏览器链接后出现的

在 deploy.yaml 里添加了一个选项禁用 reload,启动一次 alas 后会生成。改成 false 试试

这个改过后还是白屏。

按您说的后面这个方法重置winsock目录后 重启计算机,白屏问题终于解决了!
感谢老哥这一系列的reivew

@cxt986524267
Copy link

cxt986524267 commented Apr 6, 2023

经过测试,关于白屏问题,可以通过开关wegame解决,原理不明,是否可复现不明(雾)
猜测是可以通过winsock reset解决的白屏问题都可以通过这种方法解决,但这种方法不用重启电脑。

@Exziro
Copy link
Author

Exziro commented Apr 8, 2023

经过测试,关于白屏问题,可以通过开关wegame解决,原理不明,是否可复现不明(雾) 猜测是可以通过winsock reset解决的白屏问题都可以通过这种方法解决,但这种方法不用重启电脑。

是这样的。我也发现这个规律了。好像是因为wegame占得端口和本身模拟器的端口还是和这个软件的端口有冲突?我也是瞎猜的。所以一般打lol都关了。

@SaarChaffee SaarChaffee unpinned this issue Jun 2, 2023
@Gehbt
Copy link

Gehbt commented Jun 2, 2023

说一个我自己解决一个特定情况下的白屏的记录:

前提:

  • console.bat中执行alas.py可以成功运行,但是运行gui.py会产生以下错误
    ERROR: [Errno 10013] error while attempting to bind on address ('0.0.0.0', 22267): 以一种访问权限不允许的方式做了一个访问套接字的尝试。
  • netstat -ano | findstr 22267的结果为空

解决方案:

先执行命令netsh interface ipv4 show excludedportrange protocol=tcp查看到被保留的端口(的范围)
我这里的结果:

协议 tcp 端口排除范围

开始端口    结束端口
----------    --------
...
22198       22297
...
50000       50059     *
...
* - 管理的端口排除。

这里可以选择一个不在保留范围内的端口号,我这里是选择了50051
然后将.\config\deploy.yaml里的配置修改成WebuiPort: 50051
再次运行gui.py就可以运行成功了

后话:

  • 搜索里说可能和HyperV有关,我这里就是装有wsl和docker,导致了被保留的端口很多,但是似乎每台电脑的50000~50059都是排除的保留端口?(我看了两台主机是这样的)
  • 保留端口也有能够被使用的时候,但就是有时会出现被占用但是找不到占用进程的情况。
  • 我也尝试过用netsh winsock reset,但是这样会让我的TeamViewer ID更改产生麻烦。
  • 另一种解决方法,即增加动态端口的范围:netsh int ipv4 set dynamicport tcp start=22267 num=5但我没试过

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / 缺陷 Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants