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

Ubuntu-20.04.6 LTS 出现 Segmentation fault (core dumped) #43

Open
hgaonice opened this issue Apr 25, 2024 · 1 comment
Open

Ubuntu-20.04.6 LTS 出现 Segmentation fault (core dumped) #43

hgaonice opened this issue Apr 25, 2024 · 1 comment

Comments

@hgaonice
Copy link

hgaonice commented Apr 25, 2024

最后一章 http_server01 执行后,curl -v http://127.0.0.1:43211/ 服务端出现 Segmentation fault (core dumped)
./http_server01
[msg] set epoll as dispatcher, main thread
[msg] add channel fd == 5, main thread
[msg] set epoll as dispatcher, Thread-1
[msg] add channel fd == 9, Thread-1
[msg] event loop thread init and signal, Thread-1
[msg] event loop run, Thread-1
[msg] event loop thread started, Thread-1
[msg] set epoll as dispatcher, Thread-2
[msg] add channel fd == 12, Thread-2
[msg] event loop thread init and signal, Thread-2
[msg] event loop run, Thread-2
[msg] event loop thread started, Thread-2
[msg] add channel fd == 6, main thread
[msg] event loop run, main thread
[msg] epoll_wait wakeup, main thread
[msg] get message channel fd==6 for read, main thread
[msg] activate channel fd == 6, revents=2, main thread
[msg] new connection established, socket == 13
[msg] connection completed
[msg] epoll_wait wakeup, Thread-1
[msg] get message channel fd==9 for read, Thread-1
[msg] activate channel fd == 9, revents=2, Thread-1
[msg] wakeup, Thread-1
[msg] add channel fd == 13, Thread-1
[msg] epoll_wait wakeup, Thread-1
[msg] get message channel fd==13 for read, Thread-1
[msg] activate channel fd == 13, revents=2, Thread-1
[msg] get message from tcp connection connection-13
Segmentation fault (core dumped)
有同学遇到吗

hgaonice added a commit to hgaonice/yolanda that referenced this issue Apr 28, 2024
@hgaonice
Copy link
Author

hgaonice commented May 7, 2024

按照 #33 最后的 添加 #define _GNU_SOURCE 和 #include <string.h>还是无法处理,经过gdb后,发现在buffer_find_CRLF中memmem操作就存在问题。使用 vs code ssh到代码里面看到 __USE_GNU 才会使用 最后在common.h中再添加memmem方法声明即可。
image

最后添加 *void *memmem (const void *__haystack, size_t __haystacklen,const void *__needle, size_t __needlelen);

@hgaonice hgaonice closed this as completed May 7, 2024
@hgaonice hgaonice reopened this May 7, 2024
@hgaonice hgaonice closed this as completed May 7, 2024
@hgaonice hgaonice reopened this May 7, 2024
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

1 participant