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

Segmentation fault in libhttp #52

Open
jinhill opened this issue Feb 25, 2023 · 2 comments
Open

Segmentation fault in libhttp #52

jinhill opened this issue Feb 25, 2023 · 2 comments

Comments

@jinhill
Copy link

jinhill commented Feb 25, 2023

我想把FastASR结合libhttp做了一个简单的服务,但出现Segmentation fault。
参考paraformer_cli.cpp,把加载模型和识别分开
Model *load_model(const char *path, int mode);
string asr(Model *mm, const char *wav);
现象:在自己写的一个app中来调用这两个方法是可以正常使用的,但在libhttp调用就会出现Segmentation fault
(gdb) n
42 msg = mm->forward(buff, len, flag);
(gdb) p mm
$7 = (Model *) 0x7fffcc0050e0
(gdb) p buff
$8 = (float *) 0x7fffdb525090
(gdb) p len
$9 = 72880
(gdb) p flag
$10 = 2
(gdb) s

Thread 6 "civetweb-worker" received signal SIGSEGV, Segmentation fault.
0x00007ffff6bbc65b in sgemm_kernel_SANDYBRIDGE () from /lib/x86_64-linux-gnu/libopenblas.so.0

@shen2009fei
Copy link

shen2009fei commented Mar 27, 2023

我和你同样的想法,不过我是通过go ->cgo 来调用的。我也是load model 和 asr分开。
而且遇到了和你一模一样的情况。

最终我发现 :
#13 0x00007fe86cfbc7d7 in paraformer::EncSelfAttn::forward_fsmn (this=0x8, din=0x0, conv_im2col=0x7fe8414688e0) at src/lib/paraformer/EncSelfAttn.cpp:50

din 这个指针成空指针了?

@chenkui164
Copy link
Owner

@shen2009fei 你这个问题好像是内存malloc时候失败了。我不是很了解golang,从网上搜索到的是

在golang中每个协程都维护自己的栈空间,初始大小为2KB,最大为1GB。 而每个协程的堆大小也是有限制的,在64位操作系统下是1GB,32位操作系统下是250MB,超出时会panic。 相对而言,每个线程栈空间初始大小则为2MB。

golang的堆只有1G,paraformer的模型有800M,所以猜测肯能是堆的内存不够了,引起的malloc失败

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

3 participants