sigsegv or sigabrt corrupted double linked list

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dabicho
Posts: 1
Joined: 2016-06-17T10:13:50-07:00
Authentication code: 1151

sigsegv or sigabrt corrupted double linked list

Post by dabicho »

Hello.
I am writing a program to control a photo camera remotely.
In this program I use ImageMagick-c++-6.8.6.3-3 to do some processing of images (jpgs), mainly scaling.
Not sure if I am doing something wrong.

Things go like this:

Client requests preview
Server acquires preview image from camera (jpg) and uses Magick++ to scale it with a Blob and an Image

This is repeated every predefined time and all seems to go ok. The preview images are relatively small.
Then the client request the server to shoot the camera.
The server shoots the camera and gets a larger image, scales it down and sends it to the client.
Then the client can ask the server to start prevewing again.
At this point the crash occurs.
The code for handling this operations is on the same function, and the function exits after each request.

The error is sometimes sigsegv and others sigabrt with corrupted double linked list

I am getting this backtrace from gdb

Code: Select all

#0  0x00007ffff1e423ea in malloc_consolidate () from /usr/lib64/libc.so.6
#1  0x00007ffff1e43f49 in _int_malloc () from /usr/lib64/libc.so.6
#2  0x00007ffff1e4600c in malloc () from /usr/lib64/libc.so.6
#3  0x00007ffff7bbf9ee in Magick::Options::Options() () from /usr/lib64/libMagick++-6.Q16.so.1
#4  0x00007ffff7bbebf5 in Magick::ImageRef::ImageRef() () from /usr/lib64/libMagick++-6.Q16.so.1
#5  0x00007ffff7bb3ecc in Magick::Image::Image() () from /usr/lib64/libMagick++-6.Q16.so.1
#6  0x000000000040b90e in callback_camera_control (wsi=0x7fffe0052730, reason=LWS_CALLBACK_RECEIVE, user=0x7fffe00528d0, in=0x7fffe00e2450, len=34)
    at websocket_camera_control_protocol.cxx:68
#7  0x00007ffff29b13e7 in user_callback_handle_rxflow () from /usr/lib64/libwebsockets.so.7
#8  0x00007ffff29b4c23 in lws_rx_sm () from /usr/lib64/libwebsockets.so.7
#9  0x00007ffff29bc25c in lws_interpret_incoming_packet () from /usr/lib64/libwebsockets.so.7
#10 0x00007ffff29aff0e in lws_read () from /usr/lib64/libwebsockets.so.7
#11 0x00007ffff29b1e6f in lws_service_fd_tsi () from /usr/lib64/libwebsockets.so.7
#12 0x00007ffff29ba463 in lws_plat_service_tsi () from /usr/lib64/libwebsockets.so.7
#13 0x000000000040aa61 in websocket_server_manager (data=0x678ab0) at websocket_server.cxx:165
#14 0x00007ffff2e38a45 in g_thread_proxy () from /usr/lib64/libglib-2.0.so.0
#15 0x00007ffff1bb0f33 in start_thread () from /usr/lib64/libpthread.so.0
#16 0x00007ffff1ebaead in clone () from /usr/lib64/libc.so.6
Or

Code: Select all

*** Error in `/media/sf_rpmbuild/DEVEL/siirfe_gphoto_server-1.0_test/src/siirfe_gphoto_server': corrupted double-linked list: 0x00007fffe003f410 ***
======= Backtrace: =========
/usr/lib64/libc.so.6(+0x75d9f)[0x7ffff1e3bd9f]
/usr/lib64/libc.so.6(+0x7bbc7)[0x7ffff1e41bc7]
/usr/lib64/libc.so.6(+0x7d123)[0x7ffff1e43123]
/usr/lib64/libMagickCore-6.Q16.so.1(RelinquishMagickMemory+0xf)[0x7ffff74d983f]
/usr/lib64/libMagickCore-6.Q16.so.1(DestroyPixelCache+0x1df)[0x7ffff740df4f]
/usr/lib64/libMagickCore-6.Q16.so.1(DestroyImagePixels+0x95)[0x7ffff740e175]
/usr/lib64/libMagickCore-6.Q16.so.1(DestroyImage+0x6f)[0x7ffff74c553f]
/usr/lib64/libMagickCore-6.Q16.so.1(DestroyImageList+0x38)[0x7ffff74d15d8]
/usr/lib64/libMagick++-6.Q16.so.1(_ZN6Magick8ImageRefD1Ev+0x68)[0x7ffff7bbecd8]
/usr/lib64/libMagick++-6.Q16.so.1(_ZN6Magick5ImageD2Ev+0x42)[0x7ffff7bb3e62]
/media/sf_rpmbuild/DEVEL/siirfe_gphoto_server-1.0_test/src/siirfe_gphoto_server[0x40dd1e]
/usr/lib64/libwebsockets.so.7(+0x73e7)[0x7ffff29b13e7]
/usr/lib64/libwebsockets.so.7(+0x77a5)[0x7ffff29b17a5]
/usr/lib64/libwebsockets.so.7(lws_service_fd_tsi+0x179)[0x7ffff29b1d99]
/usr/lib64/libwebsockets.so.7(lws_plat_service_tsi+0xd3)[0x7ffff29ba463]
/media/sf_rpmbuild/DEVEL/siirfe_gphoto_server-1.0_test/src/siirfe_gphoto_server[0x40aaf1]
/usr/lib64/libglib-2.0.so.0(+0x6ea45)[0x7ffff2e38a45]
/usr/lib64/libpthread.so.0(+0x7f33)[0x7ffff1bb0f33]
/usr/lib64/libc.so.6(clone+0x6d)[0x7ffff1ebaead]
What may I be doing wrong?
The crash occurs with the objects declarations.

Code: Select all

  Magick::Blob dato_previo;
  Magick::Image imagen_previo; <-- This is line 68 for websocket_camera_control_protocol.cxx
  Magick::Blob dato_foto;
  Magick::Image imagen_foto; 
  Magick::Image imagen_recorte_foto;
  Magick::Geometry preview_geometry;
At main.cc I do
Magick::InitializeMagick(*argv);


Code mixes C and C++

Any idea if I am doing something wrong?
Post Reply