babelouest / ulfius

Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
https://babelouest.github.io/ulfius
GNU Lesser General Public License v2.1
1.08k stars 182 forks source link

Segmentation fault (core dumped) on websocket_example #123

Closed HuangSSShihua closed 5 years ago

HuangSSShihua commented 5 years ago

Hi, Im running the examples on ubuntu 19.04 via VM VirtualBox. The core dump issue happens when attempting to open "http://localhost:9275/static/index.html" after activating the websocket_server. I have tried on Firefox and Netsurf, while both of them failed. For other examples like sheep_counter, all work properly. The core dump issue seems to only happen for the websocket example. Any idea?

babelouest commented 5 years ago

Hello @HuangSSShihua ,

I'm gonna need more information to help you... How did you install Ulfius? Was it via the package from ubuntu or the package you downloaded on github? Or did you recompile from the source? Or some other way?

Does the segfault arrives when you start the websocket_server program or when you access the websocket endpoint? Or some other time?

HuangSSShihua commented 5 years ago

I installed it via the package from ubuntu, and the segfault arrives when I access the websocket endpoint GET http://localhost:9275/static, so as opening the url. The client side shows "Empty reply from server", while the server side displays Segfault core dumped.

babelouest commented 5 years ago

I can reproduce it too, I see where the problem comes from, I'm not sure why yet...

babelouest commented 5 years ago

I remember now, it's a bug I already fixed a few weeks ago in the development branch.

I'll backport this fix in the 2.5 branch too so future release in Debian/Ubuntu will be fixed too.

Meanwhile, if you need to explore websocket_example, I suggest you get the latest websocket_server.c from the branch 2.6, here, this one should work properly.