lgi-devs / lgi-devs/lgi

_resolve can cause luajit to segmentation fault

Open
#308 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
491
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Calling _resolve(true) with luajit 2.1.0beta3 seems to make luajit to segfault for some components. It seems to be _parent that causes problem, and calling _resolve(false) on a _parent object causes a segfault (haven't been able to find anything else causing this). This how ever doesn't seem to happen for all libraries. But I found at least 10 typelibs on my system that caused the problems.

local lgi = require 'lgi'
local gmime = lgi.require('GMime', "3.0")

gmime.init()
gmime:_resolve(true)

while true do
end

Running gdb I get: undefined symbol: g_mime_object_type_registry_shutdown. That function is only used during shutdown of gmime and shouldn't be called at all, feel like something wrong is happening before that.

I tried using luajit 2.0.5 and instead of a crash, I get a infinite loop instead.

With lua 5.4 the code works correctly and loads everything correctly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the _resolve(true) and _parent paths described in the issue, reproducing the GMime 3.0 example under LuaJIT 2.1.0beta3 and LuaJIT 2.0.5. Use gdb to inspect the reported undefined symbol and compare behavior with Lua 5.4. Done means the reproduction no longer segfaults or loops indefinitely while resolving the component.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.