Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional SIGABRT segfault #416

Open
yhagio opened this issue Mar 25, 2025 · 3 comments
Open

Occasional SIGABRT segfault #416

yhagio opened this issue Mar 25, 2025 · 3 comments
Labels

Comments

@yhagio
Copy link

yhagio commented Mar 25, 2025

Describe the bug

I have seen several times following segfault error from Ruby on Rails app but not often like once a week, but quite not sure how it happens as I cannot reproduce it easily 😢. I use ruby-vips to generate gif image like

...
image = Vips::Image.black(width, height)
text_image = Vips::Image.text(text, dpi:, font:, fontfile:)
text_image = text_image.gravity(gravity, width, height)
text_image = text_image.ifthenelse(text_color_rgb, background_color_rgb, blend: true)
image = image.composite2(text_image, :over)
...
frames << image
...
gif_image = Vips::Image.arrayjoin(frames, across: 1)
gif_image.set_type(GObject::GINT_TYPE, 'page-height', frames.first.height)
gif_image.set_type(Vips::ARRAY_INT_TYPE, 'delay', Array.new(frames.length) { 1000 })
gif_image.write_to_buffer('.gif', effort: 1)

🐛 Only error log found (but no stacktrace from application code or gem 🤷🏼 )

Program terminated with signal SIGABRT, Aborted.
--
  | Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
  | #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
  |  
  | warning: 44	./nptl/pthread_kill.c: No such file or directory
  | [Current thread is 1 (Thread 0x78be58bfd6c0 (LWP 21896))]
  | #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
  | #1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
  | #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
  | #3  0x000078beca63427e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
  | #4  0x000078beca6178ff in __GI_abort () at ./stdlib/abort.c:79
  | #5  0x000078be9d96cc04 in g_mutex_clear (mutex=<optimized out>) at ../../../glib/gthread-posix.c:1450
  | #6  g_mutex_clear (mutex=<optimized out>) at ../../../glib/gthread-posix.c:1445
  | #7  0x000078be9db6caf5 in vips_g_mutex_free () at /lib/x86_64-linux-gnu/libvips.so.42
  | #8  0x000078be9db9f70e in vips_semaphore_destroy () at /lib/x86_64-linux-gnu/libvips.so.42
  | #9  0x000078be9db76ed4 in ??? () at /lib/x86_64-linux-gnu/libvips.so.42
  | #10 0x000078be9db76a84 in ??? () at /lib/x86_64-linux-gnu/libvips.so.42
  | #11 0x000078be9d941c82 in g_thread_proxy (data=0x78be6219b320) at ../../../glib/gthread.c:835
  | #12 0x000078beca68baa4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:447
  | #13 0x000078beca718c3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Any idea what's wrong? I guess it's coming from libvips, not ruby-vips gem but not sure 🙇🏼

Additional context

Environment

  • Ubuntu 24
  • ruby version: 3.4.2
  • ruby-vips version: 2.2.3
@yhagio yhagio added the bug label Mar 25, 2025
@jcupitt
Copy link
Member

jcupitt commented Mar 26, 2025

Hello @yhagio,

How many frames are you combining? I suppose extremely large numbers might cause problems. Do you know which libvips version you are using?

You can make your code a little simpler. text now has an rgb option, so you can set the text and background colour directly:

image = Vips::Image.text('<span foreground="#xxxxxx" background="#xxxxxx">#{text}</span>')
image = image.gravity(gravity, width, height, extend: :copy)
frames << image

@kleisauke
Copy link
Member

FWIW, if you're using libvips 8.15.1 (the version provided by Ubuntu 24), please upgrade to the latest version to avoid issue libvips/libvips#3835.

@yhagio
Copy link
Author

yhagio commented Mar 26, 2025

Ah thank you both 🙏🏼 I'm using 8.15.1 I'll try upgrade 🙇🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants