Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'box.schema.func.drop' doesn't unload module #4648

Closed
rtokarev opened this issue Nov 25, 2019 · 0 comments
Closed

'box.schema.func.drop' doesn't unload module #4648

rtokarev opened this issue Nov 25, 2019 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rtokarev
Copy link
Contributor

rtokarev commented Nov 25, 2019

Tarantool version: 1.10.3-121-g7721d26

OS version: CentOS 6

Bug description:

Tarantool doesn't unload a shared library after all functions from it are dropped through box.schema.func.drop. Moreover, if you create a new function from such a library it will load it again.

(gdb) info  sharedlibrary
From                To                  Syms Read   Shared Object Library
...
                                        No          /tmp/tntBJrnGE/xtazc.so
                                        No          /tmp/tntBlQWdp/xtazc.so
                                        No          /tmp/tntLH5SmX/xtazc.so

Steps to reproduce:

  1. Create a C function, using box.schema.func.create.
  2. Call it.
  3. Drop it, using box.schema.func.drop.
  4. Repeat steps 1 - 3 a few times.
@Gerold103 Gerold103 self-assigned this Nov 26, 2019
@Gerold103 Gerold103 added the bug Something isn't working label Nov 26, 2019
Gerold103 added a commit that referenced this issue Nov 26, 2019
Error injections are used to simulate an error. They are
represented as a flag, or a number, and are used in Lua tests. But
they don't have any feedback. That makes impossible to use the
injections to check that something has happened. Something very
needed to be checked, and impossible to check in a different way.

More certainly, the patch is motivated by a necessity to count
loaded dynamic libraries to ensure, that they are loaded and
unloaded when expected. This is impossible to do in a platform
independent way. But an error injection as a debug-only counter
would solve the problem.

Needed for #4648
Gerold103 added a commit that referenced this issue Nov 26, 2019
C functions are loaded from .so/.dylib dynamic libraries. A
library is loaded when any function from there is called first
time. And was supposed to be unloaded, when all its functions are
dropped from the schema (box.schema.func.drop()), and none of them
is still in a call. But the unloading part was broken.

In fact, box.schema.func.drop() never unloaded anything. Moreover,
when functions from the module were added again without a restart,
it led to a second mmap of the same module. And so on, the same
library could be loaded any number of times.

The problem was in a useless flag in struct module preventing its
unloading even when it is totally unused. It is dropped.

Closes #4648
@kyukhin kyukhin added this to the 1.10.5 milestone Nov 27, 2019
Gerold103 added a commit that referenced this issue Nov 27, 2019
C functions are loaded from .so/.dylib dynamic libraries. A
library is loaded when any function from there is called first
time. And was supposed to be unloaded, when all its functions are
dropped from the schema (box.schema.func.drop()), and none of them
is still in a call. But the unloading part was broken.

In fact, box.schema.func.drop() never unloaded anything. Moreover,
when functions from the module were added again without a restart,
it led to a second mmap of the same module. And so on, the same
library could be loaded any number of times.

The problem was in a useless flag in struct module preventing its
unloading even when it is totally unused. It is dropped.

Closes #4648
kyukhin pushed a commit that referenced this issue Dec 10, 2019
Error injections are used to simulate an error. They are
represented as a flag, or a number, and are used in Lua tests. But
they don't have any feedback. That makes impossible to use the
injections to check that something has happened. Something very
needed to be checked, and impossible to check in a different way.

More certainly, the patch is motivated by a necessity to count
loaded dynamic libraries to ensure, that they are loaded and
unloaded when expected. This is impossible to do in a platform
independent way. But an error injection as a debug-only counter
would solve the problem.

Needed for #4648
kyukhin pushed a commit that referenced this issue Dec 10, 2019
C functions are loaded from .so/.dylib dynamic libraries. A
library is loaded when any function from there is called first
time. And was supposed to be unloaded, when all its functions are
dropped from the schema (box.schema.func.drop()), and none of them
is still in a call. But the unloading part was broken.

In fact, box.schema.func.drop() never unloaded anything. Moreover,
when functions from the module were added again without a restart,
it led to a second mmap of the same module. And so on, the same
library could be loaded any number of times.

The problem was in a useless flag in struct module preventing its
unloading even when it is totally unused. It is dropped.

Closes #4648
kyukhin pushed a commit that referenced this issue Dec 10, 2019
Error injections are used to simulate an error. They are
represented as a flag, or a number, and are used in Lua tests. But
they don't have any feedback. That makes impossible to use the
injections to check that something has happened. Something very
needed to be checked, and impossible to check in a different way.

More certainly, the patch is motivated by a necessity to count
loaded dynamic libraries to ensure, that they are loaded and
unloaded when expected. This is impossible to do in a platform
independent way. But an error injection as a debug-only counter
would solve the problem.

Needed for #4648
Gerold103 added a commit that referenced this issue Dec 11, 2019
The test started failing after my commit:
ca07088
(func: fix not unloading of unused modules), because I forgot to
update the result file.

Follow up #4648
Totktonada pushed a commit that referenced this issue Dec 11, 2019
The test started failing after my commit:
ca07088
(func: fix not unloading of unused modules), because I forgot to
update the result file.

Follow up #4648
Totktonada pushed a commit that referenced this issue Dec 11, 2019
The test started failing after my commit:
ca07088
(func: fix not unloading of unused modules), because I forgot to
update the result file.

Follow up #4648

(cherry picked from commit eddc8cc)
Gerold103 added a commit that referenced this issue Dec 11, 2019
Error injections are used to simulate an error. They are
represented as a flag, or a number, and are used in Lua tests. But
they don't have any feedback. That makes impossible to use the
injections to check that something has happened. Something very
needed to be checked, and impossible to check in a different way.

More certainly, the patch is motivated by a necessity to count
loaded dynamic libraries to ensure, that they are loaded and
unloaded when expected. This is impossible to do in a platform
independent way. But an error injection as a debug-only counter
would solve the problem.

Needed for #4648

(cherry picked from commit c3c6d3f)
Gerold103 added a commit that referenced this issue Dec 11, 2019
C functions are loaded from .so/.dylib dynamic libraries. A
library is loaded when any function from there is called first
time. And was supposed to be unloaded, when all its functions are
dropped from the schema (box.schema.func.drop()), and none of them
is still in a call. But the unloading part was broken.

In fact, box.schema.func.drop() never unloaded anything. Moreover,
when functions from the module were added again without a restart,
it led to a second mmap of the same module. And so on, the same
library could be loaded any number of times.

The problem was in a useless flag in struct module preventing its
unloading even when it is totally unused. It is dropped.

Closes #4648

(cherry picked from commit ca07088)
kyukhin pushed a commit that referenced this issue Dec 19, 2019
Error injections are used to simulate an error. They are
represented as a flag, or a number, and are used in Lua tests. But
they don't have any feedback. That makes impossible to use the
injections to check that something has happened. Something very
needed to be checked, and impossible to check in a different way.

More certainly, the patch is motivated by a necessity to count
loaded dynamic libraries to ensure, that they are loaded and
unloaded when expected. This is impossible to do in a platform
independent way. But an error injection as a debug-only counter
would solve the problem.

Needed for #4648

(cherry picked from commit c3c6d3f)
kyukhin pushed a commit that referenced this issue Dec 19, 2019
C functions are loaded from .so/.dylib dynamic libraries. A
library is loaded when any function from there is called first
time. And was supposed to be unloaded, when all its functions are
dropped from the schema (box.schema.func.drop()), and none of them
is still in a call. But the unloading part was broken.

In fact, box.schema.func.drop() never unloaded anything. Moreover,
when functions from the module were added again without a restart,
it led to a second mmap of the same module. And so on, the same
library could be loaded any number of times.

The problem was in a useless flag in struct module preventing its
unloading even when it is totally unused. It is dropped.

Closes #4648

(cherry picked from commit ca07088)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants