Debugging a malloc double free

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
andras
Prole
Posts: 14
Joined: Thu Jun 14, 2018 12:03 pm

Debugging a malloc double free

Post by andras »

Hello!

I recently added a lot of extra https calls and I see this error sometimes. I am using luasec to make the calls.

Code: Select all

thread.newThread	lib/webapi.lua
filesystem.newFileData	lib/webapi.lua
filesystem.newFile	lib/webapi.lua
love(78342,0x70000473f000) malloc: *** error for object 0x7fa822e31210: double free
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
The first three lines are logged by my allocation tracker and shows that love.thread.newThread was called by the webapi library prior to the crash. This is the small webapi lib used to make the async https calls. https://github.com/Ulydev/wapi/blob/master/webapi.lua

Can this be related to misusing LOVE threads or does it look like an issue with luasec? How can I narrow down the issue?

Thanks,
Andras
User avatar
keharriso
Party member
Posts: 109
Joined: Fri Nov 16, 2012 9:34 pm

Re: Debugging a malloc double free

Post by keharriso »

I might be able to help, but I'd need a runnable test case to replicate your error. Maybe add a minimal .love file to help out?
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
User avatar
andras
Prole
Posts: 14
Joined: Thu Jun 14, 2018 12:03 pm

Re: Debugging a malloc double free

Post by andras »

I couldn't get a test case working because getting love2d import luasec is such a pain, but I dumbed down webapi.lua to use a single thread and queue up the request. I suspect that luasec (or openssl itself) is not thread-safe, Google kinda confirms this https://github.com/brunoos/luasec/issues/66. Thanks for the help, I'm moving on.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 16 guests