Reproducible crash with get_typeof when using Lua5.4

未關閉
#101 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
lua
領域
backend

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Lua
星號
151
分支
10
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

libvips/lua-vips 的其他 Issue

查看 libvips/lua-vips 的全部 Issue

相似的 Issue

更多 Lua Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。