random core dump caused by ilegal memory free #4074
Replies: 2 comments 8 replies
-
Hello @kevisminename, That looks like the stack trace you get with a double unref -- perhaps some input buffer is being unreffed before the output image has completely finished writing? Could you work this code sample up into something I could run? I can't see how the input images are being made from this code sample, for example.
You don't need the |
Beta Was this translation helpful? Give feedback.
-
... and I would not use a libvips binary I found from somewhere I can't trace :) I would use the platform libvips. 20.04 ships with 8.9.1, which (I think?) ought to work OK for this code. If you use the official binary you can be reasonably sure there isn't some incompatibility with your system libraries. This could possibly be the cause of your crash. You can also build current stable libvips from source for 20.04. This is pretty easy in docker, for example: https://github.com/jcupitt/docker-builds/tree/master/libvips-ubuntu20.04 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Greetings, libvips is such a great image library that we used it to produce lots of images with text in it, but recently we noticed that core(SIGSEGV) has been happening for a long time since we used it (about half of year ago, it happened in a quite odd rhythm, and it did't affect our production, hence we found out this problem this late), and out of curiousty and future safety concern, we decided to take a look at it, here is the info we found out:
ubuntu 20.04.1 LTS (Focal Fossa) in a docker container
libvips-8.14.3, relase version (we did't compile it by ourself, instead downloaded it from open resource that can not be traced anymore)
cpu at average 20%-40% with 8Cs
memory at average around 40- 60% with 8G, later we upgraded the memory to 32G, memory stays around 10%-20%.
ussually one time per approxmitely one million images processed, put it in time, will happen once every 20-30hours at 10 qps, but some time occassionly, it cores after several days.
not reproducible, every time we can locate the exact input that caused the core, but under new environment, it can be processed smoothly without any problem. we even collected all the inputs that was being procesed before, during, and after the core, still did't reproduce.
All the core traces we met boils down with the same end, libc's malloc free (free invalid pointer).
- our code example:
this try block is in a warper of rpc server, it gets to be called in paralle, so there could be more than a dozen of threads running this part of code.
core happened when the try block finisnes and the
tmpImages
auto-destroys itselves, the decode part should prove that tmpImages' content is alright.We tried to compile libvips-8.14.3 in debug mode, and managed to get the debug info library in the production, but the image process became extremely slow, that we can not reach 10 qps, and no core was spotted.
so there are no detailed debug trace of the destruct function of VImage.
Without the knowledge of what Vimage's being processed and destroyed, our current guess it that it may be a memory double free problem caused by data race that only happened with certain parallel condition.
So we were hoping that anyone who might encount this problem before or who might have the sufficient knowledge of Vimage would throw us a pice of information or instructions that what might happen here and what should we do next to find our more infomation.
anything would be much appreciated.
btw
we did find and try out issue 401(lovell/sharp#401) 's method, but it did't help out.
Beta Was this translation helpful? Give feedback.
All reactions