Reproducible crash with get_typeof when using Lua5.4

Aperta
#101 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
lua
Ambito
backend

Direzione di ricerca

Start by reading Image_method:get_typeof(name) and the voperation.call implementation; the issue points to the call to vips_lib.vips_image_get_typeof(self.vimage, name) and reproductions using Image.xyz, new_from_file, and bandjoin. Investigate garbage collection behavior under Lua 5.4 and compare it with Lua 5.2, 5.3, and LuaJIT. Done means the reproductions no longer crash under Lua 5.4 without relying on stopping and restarting garbage collection.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When executing this script via lua5.4 typeof.lua I get a crash every time with the following typeof.lua script:

local vips = require "vips"
local im = vips.Image.xyz(1,1)
print(im:get_typeof("width"))

It doesn't crash with Lua 5.2, Lua 5.3 or Luajit. It also crashes in the interpreter when I enter the commands on one line like this:

Lua 5.4.8  Copyright (C) 1994-2025 Lua.org, PUC-Rio
> vips = require "vips"
> im = vips.Image.xyz(1,1); print(im:get_typeof("width"))
Ungültiger Maschinenbefehl (Speicherabzug geschrieben)

This issue (like others in the past) can be fixed by stopping and restarting garbage collection during the call to

vips_lib.vips_image_get_typeof(self.vimage, name)

in function Image_method:get_typeof(name). But there must be a better fix for these issues.

The crash also happens when I create the image with a different method that uses voperation.call, i.e.

im = vips.Image.new_from_file("filename.jpg")

or

im = vips.Image.new_from_array {0}
im = im:bandjoin(im)

In the latter example the second line is needed to create the crash. The first line doesn't use voperation.call, but calls vips_image_new_matrix_from_array directly.

I guess there is something wrong regarding garbage collection in voperation.call. It only shows up in Lu5.4 because of the more aggressive garbage collection.

Lingua principale
Lua
Stelle
151
Fork
10
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libvips/lua-vips

Tutte le issue di libvips/lua-vips

Issue simili

Altre issue su Lua

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.