[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug?] Stack Overflow with callback from external library


Le 17/03/2024 à 18:02, T Lee Davidson a écrit :
I am working with 'libmicrohttpd' which is available on Debian, Ubuntu, Arch, and probably many others.

A stack overflow occurs when a call is made to the microhttp server, which is started by the project, using `curl localhost:8080`. I have also tried a project with CivetWeb [https://github.com/civetweb/civetweb] and have gotten the same behavior (ie. "No stack." - see below). It seems that the callback Sub is not even executed as the break-point set at the top of the subroutine is not reached.

So, either I am doing something consistently wrong, there is something wrong with both libraries, or Gambas has a bug. I doubt there is something wrong with *both* libraries. But if it is that I am consistently doing something wrong, then, great, at least I'm consistent.

The project is based on the minimal example from https://www.gnu.org/software/libmicrohttpd/#quickintro which I have updated based on minimal_example.c from the libmicrohttpd-0.9.57 source and included in the project. The compiled C example works fine as does a simple example from CivetWeb.

Also included in the project are the output from GDB and, in case it helps, timestamped traces (following forks) from the minimal C example and this 'MicroHttp' project (attached).

GDB's 'bt' command reports, "No stack." And, in those respective traces the incoming HTTP connection is accepted at timestamp 12:01:21 and at timestamp 12:12:04.

Relevant links:
Reference Manual: https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html
Source code: https://ftp.gnu.org/gnu/libmicrohttpd/

[System]
Gambas=3.19.0 05b63581 (stable)
OperatingSystem=Linux
Distribution=openSUSE Leap 15.5
Kernel=5.14.21-150500.55.52-default
Architecture=x86_64
Cores=6
Memory=15981M
Language=en_US.UTF-8
Desktop=KDE
DesktopResolution=96
DesktopScale=7
WidgetTheme=breeze
Font=Noto Sans,10
** Full System Information in project **


It can't work as soon as libmicrohttpd tries to run the callback in multiple threads. Gambas interpreter can only work in one same thread.

Regards,

--
Benoît Minisini.


Follow-Ups:
Re: [Bug?] Stack Overflow with callback from external libraryT Lee Davidson <t.lee.davidson@xxxxxxxxx>
References:
[Bug?] Stack Overflow with callback from external libraryT Lee Davidson <t.lee.davidson@xxxxxxxxx>