manticoresoftware / manticoresoftware/manticoresearch
RELOAD PLUGINS sometimes fails with spurious "symbol 'PLUGIN_ver' not found ..."
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12k
- Forks
- 642
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 47
Description
**Manticore Search version:** 2.7.2
**OS version:** Debian Stretch
**Build version:** manticore_2.7.2-180827-4c1ec79-release-stemmer.stretch_amd64-bin.deb
**Description of the issue:**
Sometimes after updating plugin (here bugtest.so) and issuing `RELOAD PLUGINS`, it fails with following spurious error message. (Message is spurious because restarting manticore fixes the issue every time, so there is no problem with plugin code.)
ERROR 1064 (42000): symbol 'bugtest_ver' not found in 'bugtest.so': update your UDF implementation
**Steps to reproduce:**
1) compile bugtest.c (included below)
gcc -fPIC -shared -o bugtest.so bugtest.c
2) copy bugtest.so to plugin-dir
3) start manticore
4) connect with mysql (mysql -P9306 -h0)
5) MySQL> CREATE FUNCTION bugtest RETURNS BIGINT SONAME 'bugtest.so';
Query OK, 0 rows affected (0.00 sec)
6) comment out fopen/fclose-lines in bugtest.c, recompile, place new bugtest.so to plugin-dir
7) MySQL> RELOAD PLUGINS FROM SONAME 'bugtest.so';
ERROR 1064 (42000): symbol 'bugtest_ver' not found in 'bugtest.so': update your UDF implementation
Note that these exact steps don't always trigger this bug. Sometimes step 7 succeeds and I need to repeat (comment/uncomment those two lines; recompile; update bugtest.so; RELOAD PLUGINS) 1-2 times to get the bug to trigger. But after few tries bug always triggers.
bugtest.c:
#include "sphinxudf.h"
#include
int bugtest_ver()
{
return SPH_UDF_VERSION;
}
sphinx_int64_t bugtest(SPH_UDF_INIT * init, SPH_UDF_ARGS * args, char * error_flag)
{
FILE * fp = fopen("test", "r");
if (fp) fclose(fp);
return 0;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reload sequence with bugtest.c and sphinxudf.h: compile the shared object, install it in the plugin directory, create the function, replace the object, and run RELOAD PLUGINS. Compare successful and failing reloads while investigating the plugin-loading path. Done means repeated replacements reload without the spurious bugtest_ver error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, sql
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100