经测试,该异常仅在 nginx 反向代理环境发生,直接将服务暴露出去不会出现问题,异常界面如下图所示:
Docker 运行 b3log/siyuan 时,前台错误信息输出如下:
2021/09/21 19:37:52 [Recovery] 2021/09/21 - 19:37:52 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:221 (0x4535a6)
/usr/local/go/src/runtime/signal_unix.go:735 (0x453576)
/go/pkg/mod/github.com/gorilla/websocket@v1.4.2/conn.go:1184 (0xc20746)
/go/pkg/mod/github.com/88250/melody@v0.0.0-20201115062536-c0b3394adcd1/melody.go:172 (0xc2072e)
/go/pkg/mod/github.com/88250/melody@v0.0.0-20201115062536-c0b3394adcd1/melody.go:161 (0xed7717)
/go/src/github.com/siyuan-note/siyuan-src/kernel/server/serve.go:194 (0xed76dd)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0xc149ec)
/go/pkg/mod/github.com/gin-contrib/sessions@v0.0.3/sessions.go:52 (0xc149d8)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0xeaceac)
/go/pkg/mod/github.com/gin-contrib/gzip@v0.0.3/handler.go:60 (0xeace82)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0xc0bca1)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/recovery.go:99 (0xc0bc8c)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/context.go:165 (0xc0ab5d)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:489 (0xc0a7e5)
/go/pkg/mod/github.com/gin-gonic/gin@v1.7.4/gin.go:445 (0xc0a344)
/usr/local/go/src/net/http/server.go:2878 (0x7582da)
/usr/local/go/src/net/http/server.go:1929 (0x753987)
/usr/local/go/src/runtime/asm_amd64.s:1581 (0x4708e0)
Docker 运行命令如下:
docker run --restart=on-failure:3 -p 127.0.0.1:6806:6806 -v /data/SiYuanNote/:/data b3log/siyuan -accessAuthCode xxx -workspace /data -servePath note.xxx.cn -ssl
Nginx 配置如下:
server {
listen 443;
ssl on;
ssl_certificate /etc/letsencrypt/live/xxx.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/xxx.cn/privkey.pem;
server_name note.xxx.cn;
location / {
proxy_pass http://127.0.0.1:6806/;
}
}
server {
listen 80;
server_name note.xxx.cn;
rewrite .* https://$host$1 permanent;
}
其他运行环境:
- KVM 虚拟化云主机
- Docker version 20.10.8, build 3967b7d
- OS: Debian 10 buster
- Kernel: x86_64 Linux 4.19.0-16-amd64
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于