tarantool / tarantool/tarantool

Unable to reload C module

Open
#3,484 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

I have trouble with reload c module in Tarantool
I have a C module which expose a method:
int calculate(lua_State* L);

in addition i declared entry point:

extern "C"
{    
    LUA_API int luaopen_cuendemodule(lua_State *L);
}

now, i load this module ("testmodule.so") in tarantool:

require('testmodule')
box.schema.func.create('testmodule.calculate')
box.schema.user.grant('user', 'execute', 'function', 'testmodule.calculate')

and now I call this method from my C# client:
await tarantoolClient.Call<TarantoolTuple<CalculateParameters>, CalculationResults>("testmodule.calculate", TarantoolTuple.Create(....));
and it is work as expected - method calculate executed and results was returned

but if I want update my module than the problems begin: after I replace so file and call calculate method my Tarantool restart and I can see something like "Tarntool invalid opcode in testmodule.so" in dmesg

after reading documentation i see additional parameters in function definition like this:
box.schema.func.create('testmodule.calculate', {language = 'C'})
but after this if i call it from C# i receive exception with message "failed to dynamically load function undefined symbol calculate"

Version of Tarantool - 1.7
Version of GCC - 8.1.0

Contributor guide

Open the contributing guide

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 C entry point luaopen_cuendemodule and the box.schema.func.create calls shown in the report, then reproduce replacing testmodule.so on Tarantool 1.7. Compare the normal registration with the {language = 'C'} path and verify that reloading the module no longer causes an invalid opcode or an undefined symbol error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, csharp, lua
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.