Hide symbols back #5733
Replies: 4 comments 1 reply
-
We discussed the problem with @Mons and @LeonidVas. The discussion results and my further thoughts are summarized below. There are symbols from tarantool itself and from libraries we bundle into tarantool. The memcached problem was due to a clash of symbols from different version of the small library. We don't meet a problem with clashing of a symbol from a module (or a module library) with tarantool's own symbol, however it is possible. I looked over tarantool symbols that're exported now (due to default visibility) and some of them looks quite clashable: The list of private tarantool symbols with pretty simple names.base64_encode So it should be changed some day: we should hide tarantool's own symbols excepts ones that are part of our module API and Lua/C API. We should also create wrappers for built-in library symbols that are called with LuaJIT FFI (such as msgpuck ones) and eliminate direct exports. Regarding libraries. We should hide symbols from our built-in libraries except several ones. The library should meet several criterias to be included in the list of the disclosed ones:
The libraries to export are the following:
How exactly we should expose a library API:
Since @Mons want to keep ability to call hidden functions to have a chance to fix a known problem in a released version, we should propose a way to call a function using FFI by an address from a debug info. At least he want access to tarantool's own symbols and symbols from We can eat the pie piece by piece: say, close |
Beta Was this translation helpful? Give feedback.
-
Issue #5932 |
Beta Was this translation helpful? Give feedback.
-
Seems that discussion can be closed? |
Beta Was this translation helpful? Give feedback.
-
Status 2022-03-04We resolved the main problem in #5932. The symbols were open in 2.5.0-42-g03790ac55 and closed back in 2.9.0-244-g5ceabb378. The list of tarantool releases, affected by the problem:
2.10.0-beta1 and following (pre)releases are NOT affected. We will consider accurate opening (and freezing in the public C API) of useful symbols. See #6372 and #6369. This activity is stalled now. I also found that some libsmall's symbols are still opened to use via LuaJIT FFI from inside tarantool itself (not as a public API). See #6873. We'll investigate, whether it may lead to problems for Lua/C modules, which use its own libsmall (such as memcached), and likely will remove them from exports. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After #2971 we experience a bunch of problems (1, 2). The second one still have no good solution. You can find more on the topic here.
Another side of the problem is that I heard from time to time: hey, someone can check that a symbol is present and use it in a module despite that there is no statement that we'll keep it. Yet another side of the problem is that C API description on the website significantly behind the actual state (at least I see no actions around new APIs), but it is out of scope here.
My proposal:
The only advantage of the unhiding symbols: sometimes you can hack something for certain tarantool executable using LuaJIT's FFI, but you'll anyway unable to use this hack in a module, because the symbol may disappear in any build: even from the same tarantool version range, but with other OS or toolchain.
The situation for tarantool executable is the same as for any other library. A library should expose only its public API and should not increase probability of hard to debug problems due to clash of a user's code with an internal name from the library.
The discussion in PR #5720 motivates me to revisit our symbols visibility policy.
Beta Was this translation helpful? Give feedback.
All reactions