ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Table looked up by id after shutdown #1426

Closed ctm closed 1 month ago

ctm commented 1 month ago

Fix so we don't get the no mut table warning.

Starting with May 13th's tournament we often get two no mut table warning right after a table shuts down:

[master]% gzcat * | rg 'no .*table at '
gzcat * | rg 'no .*table at '
2024-05-14T00:32:17.758018227Z WARN  [mb2::tournament] no mut table at 5841
2024-05-14T00:32:17.758080949Z WARN  [mb2::tournament] no mut table at 5841
2024-05-15T01:28:40.047963948Z WARN  [mb2::tournament] no mut table at 5843
2024-05-15T01:28:40.048016219Z WARN  [mb2::tournament] no mut table at 5843
...
2024-05-22T00:32:00.436044094Z WARN  [mb2::tournament] no mut table at 5858
2024-05-22T00:32:00.436083825Z WARN  [mb2::tournament] no mut table at 5858

mb2=> select * from tables where id in (5841, 5843, 5847, 5848, 5850, 5855, 5856, 5858) order by id;
  id  | event_id |          created_at           |          finished_at          
------+----------+-------------------------------+-------------------------------
 5841 |     5271 | 2024-05-14 00:05:00.522272+00 | 2024-05-14 00:32:17.757349+00
 5843 |     5272 | 2024-05-15 00:05:00.200931+00 | 2024-05-15 01:28:40.045728+00
...
 5858 |     5383 | 2024-05-22 00:05:00.394235+00 | 2024-05-22 00:32:00.433655+00
(8 rows)

There are fourteen calls to mut_table_at in tournament.rs, so I'll eyeball each of them and also take a look at commits I made prior to the May 13th tournament and see if anything jumps out at me. If not, I'll simply add a backtrace to the warning and wait for it to happen again.

This doesn't appear to affect anyone, but I don't like ignoring warnings and it's been slightly over a week.

ctm commented 1 month ago

FWIW, none of these are at the tournament end, so each of them is after a table merge. Since it doesn't happen every time, my guess is it's a NickMapper table motion race condition. I super briefly thought it might be chat related, because I had done some chat work a while back, but with the warning coming in 0.000669 seconds after the finishing of the table, that seems … unlikely.

It's close enough to this evening's tournament that I'm just going to add a backtrace and get back to more important things, even though I suspect I could find and fix this simply from code inspection.

ctm commented 1 month ago

The warn! didn't get invoked last night, but I looked at this just now with fresh eyes and saw the problem in under five minutes. It was indeed introduced with a recent change (#1405) and it has a trivial fix which I'm deploying now.