ctm / mb2-doc

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

Only one card and can't act #1306

Closed ctm closed 6 months ago

ctm commented 6 months ago

Figure out what happened and then update this ticket and then fix it

JADC🚴: cliff gerdog: WRF DH we obly have one card and cannot act gerdog: table 5665 gerdog: and now everythiong came back JADC🚴: out of order

This is the WYWAE B.O.S.S. tournament.

ctm commented 6 months ago

Although I didn't write it down at the time, gerdog's message in the lobby was written 20 minutes after the start of tournament (i.e. 7:20pm Mountain, where I live). This was the first hand on a new table, and player_id 11 is gerdog, so we can see where he closed his table and got resent the Dealing message.

mb2=> select id, received_at at time zone 'america/denver', hand_id, player_id, message from public_table_messages where variant = 38 and table_id = 5665 order by id asc;
    id    |          timezone          | hand_id | player_id |                                                          message                                                          
----------+----------------------------+---------+-----------+---------------------------------------------------------------------------------------------------------------------------
 10466514 | 2024-02-03 19:19:44.424813 |  392793 |           | {"Dealing": ["600 1200 (200) Super Stud (High/Low Eight Qualifier)", 1, "StudLimit", 0, true, 392793, true, false, 0]}
 10466529 | 2024-02-03 19:19:49.625687 |         |        45 | {"Dealing": ["600 1200 (200) Super Stud (High/Low Eight Qualifier)", 1, "StudLimit", 0, true, 392793, true, false, 0]}
 10466597 | 2024-02-03 19:20:31.624966 |         |        11 | {"Dealing": ["600 1200 (200) Super Stud (High/Low Eight Qualifier)", 1, "StudLimit", 0, true, 392793, true, false, 0]}
 10466814 | 2024-02-03 19:22:09.97288  |  392797 |           | {"Dealing": ["800 1600 Big O (High/Low Eight Qualifier)", 0, "SplitLimit", 5, false, 392797, true, false, 1]}
...
ctm commented 6 months ago

Here are all the public messages:

mb2=> select id, received_at at time zone 'america/denver', hand_id, substr(message::text, 0, 150) from public_table_messages where table_id = 5665 and id < 10466814 and player_id is null order by received_at asc;
    id    |          timezone          | hand_id |                                                                        substr                                                                         
----------+----------------------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------
 10466506 | 2024-02-03 19:19:44.355812 |  392792 | {"NewPlayersAdded": [5113, [45]]}
 10466507 | 2024-02-03 19:19:44.369196 |  392792 | {"MovedFrom": [35, 5663, "fryday", null]}
 10466509 | 2024-02-03 19:19:44.392971 |  392792 | {"MovedFrom": [11, 5663, "gerdog", null]}
 10466511 | 2024-02-03 19:19:44.411401 |  392792 | {"MovedFrom": [28, 5664, "JADC🚴", null]}
 10466514 | 2024-02-03 19:19:44.424813 |  392793 | {"Dealing": ["600 1200 (200) Super Stud (High/Low Eight Qualifier)", 1, "StudLimit", 0, true, 392793, true, false, 0]}
 10466519 | 2024-02-03 19:19:46.356304 |  392793 | {"EveryoneAntes": 100}
 10466520 | 2024-02-03 19:19:46.360764 |  392793 | {"Status": {"board": {"grid": null, "cards": {"cards": []}}, "button": {"seat": 3, "small_blind": 0}, "players": [{"id": 35, "seat": 0, "cards": {"ca
 10466521 | 2024-02-03 19:19:46.36522  |  392793 | {"Remind": [20000, 0, "2024-02-04T02:20:06.355110409Z", 35, 20]}
 10466551 | 2024-02-03 19:20:06.357993 |  392793 | {"Vacationed": 35}
 10466552 | 2024-02-03 19:20:06.363679 |  392793 | {"Checks": [35, null]}
 10466553 | 2024-02-03 19:20:06.368852 |  392793 | {"Remind": [20000, 0, "2024-02-04T02:20:26.356534773Z", 11, 20]}
 10466554 | 2024-02-03 19:20:08.276246 |  392793 | {"IsBackFromVacation": 35}
 10466573 | 2024-02-03 19:20:19.17141  |  392793 | {"Chat": [28, "what happened?"]}
 10466574 | 2024-02-03 19:20:19.520523 |  392793 | {"Chat": [11, "ummmm why do i only have 1 card?"]}
 10466584 | 2024-02-03 19:20:26.359919 |  392793 | {"Vacationed": 11}
 10466585 | 2024-02-03 19:20:26.366174 |  392793 | {"Checks": [11, null]}
 10466586 | 2024-02-03 19:20:26.37061  |  392793 | {"Remind": [20000, 0, "2024-02-04T02:20:46.357063694Z", 28, 20]}
 10466587 | 2024-02-03 19:20:28.24498  |  392793 | {"IsBackFromVacation": 11}
 10466590 | 2024-02-03 19:20:29.315738 |  392793 | {"OnLevel": ["Level 5", [299999, "2024-02-04T02:25:29.304632971Z"], false, 4]}
 10466610 | 2024-02-03 19:20:32.295325 |  392793 | {"MoreTime": [28, 40, "2024-02-04T02:21:12.293820313Z", 40]}
 10466659 | 2024-02-03 19:21:12.297187 |  392793 | {"Vacationed": 28}
 10466660 | 2024-02-03 19:21:12.30153  |  392793 | {"Checks": [28, null]}
 10466661 | 2024-02-03 19:21:12.306091 |  392793 | {"Remind": [20000, 0, "2024-02-04T02:21:32.295678150Z", 45, 20]}
 10466666 | 2024-02-03 19:21:15.472363 |  392793 | {"IsBackFromVacation": 28}
 10466691 | 2024-02-03 19:21:32.2987   |  392793 | {"Vacationed": 45}
 10466692 | 2024-02-03 19:21:32.303932 |  392793 | {"Folds": [45, true, null, "NoShow"]}
 10466693 | 2024-02-03 19:21:32.308778 |  392793 | {"BeginRound": [0, [1, {"draw": {"Discard": [2, 2]}, "combination": "Without"}], 200, 600, false, 253]}
 10466694 | 2024-02-03 19:21:32.313732 |  392793 | {"Status": {"board": {"grid": null, "cards": {"cards": []}}, "button": {"seat": 3, "small_blind": 0}, "players": [{"id": 35, "seat": 0, "cards": {"ca
 10466695 | 2024-02-03 19:21:32.318659 |  392793 | {"BringIn": [20000, 200, 600, "2024-02-04T02:21:52.297223761Z", 11, 20]}
 10466698 | 2024-02-03 19:21:34.618744 |  392793 | {"IsBackFromVacation": 45}
 10466724 | 2024-02-03 19:21:52.299814 |  392793 | {"Vacationed": 11}
 10466725 | 2024-02-03 19:21:52.304602 |  392793 | {"BringsIn": [11, 200, false, "Vacation"]}
 10466726 | 2024-02-03 19:21:52.309437 |  392793 | {"Folds": [11, true, null, "Vacation"]}
 10466727 | 2024-02-03 19:21:52.314208 |  392793 | {"Remind": [20000, 200, "2024-02-04T02:22:12.298252269Z", 28, 20]}
 10466728 | 2024-02-03 19:21:53.792323 |  392793 | {"IsBackFromVacation": 11}
 10466794 | 2024-02-03 19:22:01.090995 |  392793 | {"Calls": [28, null, false, 300]}
 10466795 | 2024-02-03 19:22:01.09597  |  392793 | {"Remind": [20000, 200, "2024-02-04T02:22:21.089480575Z", 35, 20]}
 10466803 | 2024-02-03 19:22:06.961232 |  392793 | {"Folds": [35, false, null, null]}
 10466804 | 2024-02-03 19:22:06.983189 |  392793 | {"EndOfHand": {"penalties": [], "player_amounts": [[[28, [800, 0]]]], "split_hand_names": ["High", "Low"], "player_revelations": [{"player_id": 28, "
 10466811 | 2024-02-03 19:22:08.804192 |  392793 | {"Chat": [45, "what is going on"]}
(40 rows)
ctm commented 6 months ago

I don't like adding private messages to these public GitHub issues, but I have indeed looked at private_table_messages, and id 12709095 is indeed a Cards message with a single upcard.

This is most likely a bug related to Table::dup. There are some state fields that are cloned that might not be properly reset at the beginning of the hand. They've worked so well for so long that I don't even remember their specifics, but I'm thinking about mixed_deals and mixed_deals_limit_action. There may be others.

I'm optimistic that this is going to leap out at me once I look at some of those esoteric fields.

ctm commented 6 months ago

Sure enough, mixed_deals is cloned rather than set to Default::default() and the way mixed_deals is reset is in Table::deal, not in begin_hand_pre_shuffle or begin_hand_post_shuffle.

So, clone was a poor choice.

ctm commented 6 months ago

Fixed and merged to master. I'll deploy it after this evening's tournament is over.