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

./skynet examples/config.c1报错闪退 #1945

Open
hanyu363 opened this issue Jun 23, 2024 · 12 comments
Open

./skynet examples/config.c1报错闪退 #1945

hanyu363 opened this issue Jun 23, 2024 · 12 comments

Comments

@hanyu363
Copy link
Contributor

运行范例example/config.c1报错。。
最后一行日志显示。
[:00000002] LAUNCH snlua bootstrap
[:00000003] LAUNCH snlua launcher
[:00000004] LAUNCH snlua cdummy
[:00000005] LAUNCH harbor 0 4
[:00000006] LAUNCH snlua datacenterd
[:00000007] LAUNCH snlua service_mgr
[:00000008] LAUNCH snlua cluster1
[:00000009] LAUNCH snlua clusterd
[:0000000a] LAUNCH snlua simpledb
[:00000009] Register [sdb] :0000000a
[:00000009] Unregister [sdb] :0000000a
[:00000009] Register [sdb] :0000000a
nil
nil
foobar
foobar2
[:0000000b] LAUNCH snlua gate
Bus error

尝试单独回滚提交。依次尝试。。
d629648
这次提交的内容。导致的这个运行这个example。闪退。
Avoid to use je_malloc_usable_size, See #1907

@cloudwu
Copy link
Owner

cloudwu commented Jun 23, 2024

31a4688
6a7043c

和它是相关的,不可以单独使用 d629648

@cloudwu
Copy link
Owner

cloudwu commented Jun 23, 2024

为避免问题,我已将以上几个关联 commit 合并为一个:89a821c

后续几个 commits 是为了修复其中没有写对的 skynet_calloc()

@cloudwu
Copy link
Owner

cloudwu commented Jun 23, 2024

我查了一下,skynet 中并没有直接使用 calloc 。我的系统上并不会出错,所以你需要具体定位你的问题。

@hanyu363
Copy link
Contributor Author

奇怪了。是不是我的系统是用alpine 3.19导致的。
我拉取了最新的代码。。编译运行测试范例就会闪退。。
用release tag的版本就没问题。

@cloudwu
Copy link
Owner

cloudwu commented Jun 24, 2024

你可以 gdb 看看出错在哪里。或者再 review/debug 一下 89a821c ,它的修改并不复杂。就是把 memory cookie 从内存块的尾部移到了头部而已,并额外记录了内存块的 size ,不再依赖 malloc_usable_size 。理论上来说,它减少了而不是增加了对 CRT 的依赖。

@hanyu363
Copy link
Contributor Author

我先停止更新至最新版本。保证团队开发进度。
在研究一下吧。。我没有底层开发能力。。gdb基本没用过。。
我看看能不能继续定位到准确行数。

@cloudwu
Copy link
Owner

cloudwu commented Jun 24, 2024

@EfveZombie 也可以看看之前的修改会不会还有什么问题。
@hanyu363 你可以加上 MEMORY_CHECK 宏,看看是否能发现问题。

@ylme
Copy link

ylme commented Jun 24, 2024

建议试试 make cleanall 之后再重新 make 运行试试

@EfveZombie
Copy link
Contributor

重新 review 了一下, 没看出什么会导致 crash 的问题, 可能 skynet_realloc 中先 get_cookie_sizeclean_prefix 语义会比较明确一些, 然后 skynet_calloc 里面 fill_prefixsize 参数填 nmemb * size 跟其它接口的含义统一, 不过都不影响逻辑正常运行才对

@cloudwu
Copy link
Owner

cloudwu commented Jun 24, 2024

重新 review 了一下, 没看出什么会导致 crash 的问题, 可能 skynet_realloc 中先 get_cookie_sizeclean_prefix 语义会比较明确一些, 然后 skynet_calloc 里面 fill_prefixsize 参数填 nmemb * size 跟其它接口的含义统一, 不过都不影响逻辑正常运行才对

是的,这个只影响统计,且 skynet 事实上并没有使用 calloc 。我改了一下:aa20f76

@hanyu363
Copy link
Contributor Author

我现在的复现步骤就是。
启动一个alpine:3.19的镜像。
安装好编译工具
从github中clone好源码
make linux
进行编译。。
完成后。。
skynet examples/config.c1
之后。就会出现闪退。。
好像就是cluster.open的时候出问题了。。
你们在本地编译竟然没问题。我就郁闷了。。
我用别的系统在试试。

@spin6lock
Copy link
Contributor

spin6lock commented Jul 5, 2024

我用alpine:3.19和最新master (059fd5c ) 没法复现呢,重现步骤:

docker pull alpine:3.19
docker run -it alpine:3.19 sh
apk add gcc git musl-dev make autoconf
git clone https://github.com/cloudwu/skynet.git
cd skynet
make linux
./skynet examples/config.c1

输出:

/skynet # ./skynet examples/config.c1
[:00000002] LAUNCH snlua bootstrap
[:00000003] LAUNCH snlua launcher
[:00000004] LAUNCH snlua cdummy
[:00000005] LAUNCH harbor 0 4
[:00000006] LAUNCH snlua datacenterd
[:00000007] LAUNCH snlua service_mgr
[:00000008] LAUNCH snlua cluster1
[:00000009] LAUNCH snlua clusterd
[:0000000a] LAUNCH snlua simpledb
[:00000009] Register [sdb] :0000000a
[:00000009] Unregister [sdb] :0000000a
[:00000009] Register [sdb] :0000000a
nil
nil
foobar
foobar2
[:0000000b] LAUNCH snlua gate
[:0000000b] Listen on 127.0.0.1:2528
[:0000000c] LAUNCH snlua gate
[:0000000c] Listen on 127.0.0.1:2529
[:0000000d] LAUNCH snlua snaxd pingserver
ping server start:
[:00000002] KILL self

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

No branches or pull requests

5 participants