{"id":20704334,"url":"https://github.com/osch/lua-threading-playground","last_synced_at":"2025-10-08T09:51:03.158Z","repository":{"id":66985043,"uuid":"273542730","full_name":"osch/lua-threading-playground","owner":"osch","description":"Multi threading test cases crashing under LuaJIT","archived":false,"fork":false,"pushed_at":"2020-06-19T17:33:05.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T04:45:28.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-19T16:44:09.000Z","updated_at":"2020-06-19T20:33:53.000Z","dependencies_parsed_at":"2023-05-16T14:15:23.961Z","dependency_job_id":null,"html_url":"https://github.com/osch/lua-threading-playground","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/osch/lua-threading-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-threading-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-threading-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-threading-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-threading-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osch","download_url":"https://codeload.github.com/osch/lua-threading-playground/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osch%2Flua-threading-playground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278924138,"owners_count":26069400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T01:11:58.350Z","updated_at":"2025-10-08T09:51:03.108Z","avatar_url":"https://github.com/osch.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test Cases for multi threading Lua\n\nThis repository contains two test cases that are showing crashes \nusing LuaJIT when native lua packages are loaded in other threads.\n\n### Tests\n\n   * [test01](#test01) - uses [lua-llthreads2] as threading library and\n                         [lpeg] as native lua package\n\n   * [test02](#test02) - uses [luaproc] as threading library and\n                         [luafilesystem] as native lua package\n\n#### Test Results for both tests:\n   \n   * no crash with Lua 5.1, 5.2 and 5.3\n   * crash with LuaJIT 2.0 and 2.1 under Linux\n   * see [Travis CI Results] for result details\n\n```\n*** Error in `lua': double free or corruption (fasttop): 0x00007f43400008c0 ***\n```   \n\n## [test01](test01.lua)\n\n```lua\n    local llthreads = require(\"llthreads2.ex\")\n    \n    local THREAD_COUNT = 1000\n    \n    local thread_code = function()\n    \n        local lpeg = require(\"lpeg\") -- no crash without this line\n    \n        local loadstring = loadstring or load\n        local x = 1\n        while x \u003c 1000 do \n            x = x + 1 \n            -- do some work\n            assert(x == loadstring(\"return \"..x)())\n        end\n    end\n    \n    local threads = {}\n    \n    for i = 1, THREAD_COUNT do \n        local thread = llthreads.new(thread_code)\n        threads[i] = thread\n        thread:start()\n    end\n    \n    for i = 1, THREAD_COUNT do \n        local thread = threads[i]\n        thread:join()\n    end\n    print(\"OK.\")\n\n```\n\n## [test02](test02.lua)\n\n```lua\n    local luaproc = require(\"luaproc\")\n    \n    local THREAD_COUNT = 1000\n    luaproc.setnumworkers(THREAD_COUNT)\n    \n    local thread_code = function()\n    \n        local lpeg = require(\"lfs\") -- no crash without this line\n    \n        local loadstring = loadstring or load\n        local x = 1\n        while x \u003c 1000 do \n            x = x + 1 \n            -- do some work\n            assert(x == loadstring(\"return \"..x)())\n        end\n    end\n    \n    local threads = {}\n    \n    for i = 1, THREAD_COUNT do \n        local thread = luaproc.newproc(thread_code)\n        threads[i] = thread\n    end\n    \n    luaproc.wait()\n    \n    print(\"OK.\\n\")\n```\n\n\n[lua-llthreads2]:    https://luarocks.org/modules/moteus/lua-llthreads2\n[luaproc]:           https://luarocks.org/modules/askyrme/luaproc\n[lpeg]:              https://luarocks.org/modules/gvvaughan/lpeg\n[luafilesystem]:     https://luarocks.org/modules/hisham/luafilesystem\n[Travis CI Results]: https://travis-ci.com/github/osch/lua-threading-playground\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosch%2Flua-threading-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosch%2Flua-threading-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosch%2Flua-threading-playground/lists"}