|
The hashtable mechanism provided in hashtable.c is used to store information about users. The hashtable is linked from the service structure.
It is possible (precise circumstances unknown) for a hashtable to have the appearance of having been freed, even though it is pointed to by what appears to be a valid service (which in turn is pointed to by a valid DCB).
The situation is ameliorated in the MXS-329 branch by checking the table size for being zero before using it in the modulo operation - this will prevent the crash illustrated below, but is only a hack - the table size should never be zero and has presumably only become zero as a result of the hashtable being freed.
Diagnostic information:
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7fffd8ae9700 (LWP 10729)]
0x000000000056f8a2 in hashtable_fetch (table=0x1ac0960, key=0x7fffbc001e79) at /usr/local/skysql/maxscale/MaxScale/server/core/hashtable.c:385
385 hashkey = table->hashfn(key) % table->hashsize;
(gdb) p *table
$8 = {ht_chk_top = 28027520, hashsize = 0, entries = 0x1abaa90, hashfn = 0xab4fc9 <simple_str_hash(char*)>, cmpfn = 0x7ffff5a7d350 <__strcmp_sse42>, kcopyfn = 0x7ffff59d5e70 <strdup>,
vcopyfn = 0x7ffff59d5e70 <strdup>, kfreefn = 0x7ffff59d0520 <free>, vfreefn = 0x7ffff59d0520 <free>, spin =
{lock = 0}
, n_readers = 0, writelock = 0, ht_isflat = false,
ht_chk_tail = CHK_NUM_HASHTABLE}
(gdb) bt full
#0 0x000000000056f8a2 in hashtable_fetch (table=0x1ac0960, key=0x7fffbc001e79) at /usr/local/skysql/maxscale/MaxScale/server/core/hashtable.c:385
hashkey = 32767
entry = 0x81fb5f48
#1 0x00007fffdb906696 in check_db_name_after_auth (dcb=0x7fffb8014e00, database=0x7fffbc001e79 "employees", auth_ret=0)
at /usr/local/skysql/maxscale/MaxScale/server/modules/protocol/mysql_common.c:2186
db_exists = -1
#2 0x00007fffdb8fdbca in gw_mysql_do_authentication (dcb=0x7fffb8014e00, buf=0x7fffd8ae5b88) at /usr/local/skysql/maxscale/MaxScale/server/modules/protocol/mysql_client.c:580
queue = 0x7fffbc007080
protocol = 0x7fffb8014ad0
connect_with_db = 8
client_auth_packet = 0x7fffbc002f60 "["
client_auth_packet_size = 95
username = 0x7fffbc001df8 "peddy"
database = 0x7fffbc001e79 "employees"
auth_token_len = 20
auth_token = 0x7fffbc003880 "ܯY\030\211\202Z\a\352\307\063\275IQv3\005W\373", <incomplete sequence \336>
stage1_hash = 0x7fffbc001de4 "PLo\033\201j\302`\300\017\030+S\004\320\062*\260I\rpeddy"
auth_ret = 0
client_data = 0x7fffbc001de0
ssl = 0
_FUNCTION_ = "gw_mysql_do_authentication"
_PRETTY_FUNCTION_ = "gw_mysql_do_authentication"
#3 0x00007fffdb8fe73a in gw_read_client_event (dcb=0x7fffb8014e00) at /usr/local/skysql/maxscale/MaxScale/server/modules/protocol/mysql_client.c:905
auth_val = 5578943
session = 0x1173ce0
router = 0x0
router_instance = 0x0
rsession = 0x0
protocol = 0x7fffb8014ad0
read_buffer = 0x7fffbc007080
rc = 0
nbytes_read = 95
cap = 0 '\000'
stmt_input = false
_FUNCTION_ = "gw_read_client_event"
_PRETTY_FUNCTION_ = "gw_read_client_event"
#4 0x000000000056711a in process_pollq (thread_id=5) at /usr/local/skysql/maxscale/MaxScale/server/core/poll.c:948
dcb = 0x7fffb8014e00
found = 1
ev = 5
qtime = 0
_FUNCTION_ = "process_pollq"
_PRETTY_FUNCTION_ = "process_pollq"
#5 0x000000000056666a in poll_waitevents (arg=0x5) at /usr/local/skysql/maxscale/MaxScale/server/core/poll.c:692
events = events = 5, data = {ptr = 0x7fffb8014e00, fd = -1207874048, u32 = 3087093248, u64 = 140736280481280, {events = 4, data = {ptr = 0x7fffbc005680, fd = -1140828544,
u32 = 3154138752, u64 = 140736347526784}}, {events = 4, data = {ptr = 0x7fffc800a180, fd = -939482752, u32 = 3355484544, u64 = 140736548872576}}, {events = 0, data = {ptr = 0x0,
fd = 0, u32 = 0, u64 = 0}} <repeats 997 times>}
i = 1
nfds = 1
timeout_bias = 1
thread_id = 5
poll_spins = 0
_FUNCTION_ = "poll_waitevents"
#6 0x00007ffff70cc9d1 in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#7 0x00007ffff5a3d8fd in clone () from /lib64/libc.so.6
No symbol table info available.
(gdb) +
|