Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client freeze due to infinite loop in render thread #1674

Open
Spasitjel opened this issue Mar 19, 2024 · 1 comment
Open

Client freeze due to infinite loop in render thread #1674

Spasitjel opened this issue Mar 19, 2024 · 1 comment

Comments

@Spasitjel
Copy link

Describe the bug
The client permanently freezes, and the window becomes unresponsive.

To Reproduce
It's very rare and hard to reproduce, I've only tested it with Razor Enhanced, but it seems to be happening with scripts that make the player move, be it a single step with the Walk function or the RE pathfinding.

Expected behavior
Not freezing.

Information (please complete the following information):

Additional context
When I attach a debugger what I see is that the logic is stuck in this loop:

for (GameObject obj = chunk.GetHeadObject(x, y); obj != null; obj = obj.TNext)
{
sbyte tileZ = obj.Z;

The loop takes the next object to process via obj.TNext, what I notice is that the obj refers to my player and that TNext is always my player, which causes the infinite loop.

I tried to add code in all the places where TNext is set, to catch when such connection between the objects is done, but I haven't been able to properly catch it yet.

@Coji4000
Copy link

I believe this is caused by the packet decompression and circularbuffer when plugins are active. here are some samples from my packetdumps:

This is a packet that begins part way through data that belongs inside and ID: 78. it's incorrectly processing the 0A as the ID because bytes have gone missing from the capture from the buffer. (assuming some offsetting issue but im not sure) It proceeds to read the next few packets incorrectly as well since they are offset due to the missing bytes. the client recovers everything except movement input and occasionally opens random gumps due to bad data and incorrectly IDd packets.

          Ticks: 9137104 | Server -> Client |  ID: 0A   Length: 11
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  0A 0E 00 02 84 01 00 01  78 00 4E                 ........x.N



          Ticks: 9137104 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 08 C4 92 01 90 0C 67  0A 0C 14 82 03 EA 80 01  .......g........
00000010  40 3F 3C F5 0E 75 15 40  3F 3D 02 97 0F 03 06 A6  @?<..u.@?=......
00000020  40 16 8F 0F 1D B9 06 40  16 1B 2D 13 EB 07 40 3F  @......@..-...@?
00000030  3C F7 0F 52 01 7F DC E9  B7 A0 45 0B 04 6A 7F DC  <..R.�....E..j�.
00000040  E9 B6 A0 41 10 04 7D 00  00 00 00 DC 00 08 C4 92  ...A..}.........
00000050  41 A4 2C F1 DF 00 2E 00  08 C4 92 03 F4 00 01 00  A.,.............
00000060  00 00 00 03 F4 00 01 00                           ........



          Ticks: 9137287 | Client -> Server |  ID: F0   Length: 5
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  F0 00 05 01 01                                    .....



          Ticks: 9137354 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 00 00 00 00 00 00 00  00 10 69 C7 00 10 69 C8  ..........i...i.
00000010  00 00 00 00 00 00 00 00  00 00 C1 00 32 00 08 C4  ............2...
00000020  92 01 90 00 01 F4 00 03  00 07 A5 F8 4C 69 6C 53  ............LilS
00000030  70 75 64 00 00 00 00 00  00 00 00 00 00 00 00 00  pud.............
00000040  00 00 00 00 00 00 00 00  00 00 00 00 73 03 77 00  ............s.w.
00000050  0B 5C 79 01 90 0C 60 0A  0F 00 05 84 01 00 01 77  .\y...`........w
00000060  00 0B 5C 79 01 90 0C 60                           ..\y...`



          Ticks: 9137729 | Server -> Client |  ID: 0A   Length: 11
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  0A 0F 00 05 84 01 00 01  77 00 0B                 ........w..



          Ticks: 9137729 | Server -> Client |  ID: 5C   Length: 2
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  5C 79                                             \y



          Ticks: 9137729 | Server -> Client |  ID: 01   Length: 5
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  01 90 0C 61 0A                                    ...a.

This packet begins in the middle of an ID: 77 and clobbers quite a few packets.

          Ticks: 5203749 | Server -> Client |  ID: 0A   Length: 11
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  0A 14 00 07 84 0E 02 01  77 00 01                 ........w..



          Ticks: 5203749 | Server -> Client |  ID: E6   Length: 5
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  E6 0E 01 91 0D                                    .....



          Ticks: 5203749 | Server -> Client |  ID: 22   Length: 3
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  22 0A 14                                          "..



          Ticks: 5203963 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 07 84 0E 02 01 22 9B  01 20 00 08 C4 92 01 90  ......".. ......
00000010  00 03 EA 00 0D 24 0A 11  00 00 82 14 78 00 4E 00  .....$......x.N.
00000020  08 C4 92 01 90 0D 24 0A  11 14 82 03 EA 00 01 40  ......$........@
00000030  3F 3C F5 0E 75 15 40 3F  3D 02 97 0F 03 06 A6 40  ?<..u.@?=......@
00000040  16 8F 0F 1D B9 06 40 16  1B 2D 13 EB 07 40 3F 3C  ......@..-...@?<
00000050  F7 0F 52 01 7F DC E9 B7  A0 45 0B 04 6A 7F DC E9  ..R.�....E..j�..
00000060  B6 A0 41 10 04 7D 00 00                           ..A..}..



          Ticks: 5203963 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 00 78 00 64 00 04 FA  57 01 91 0D 1E 0A 16 14  ..x.d...W.......
00000010  02 04 1C 02 01 40 26 10  49 97 0B 03 07 52 40 26  .....@&.I....R@&
00000020  10 4A 93 CC 0D 09 73 40  26 10 4B 93 CD 13 09 73  .J....s@&.K....s
00000030  40 26 10 4C 93 CB 04 09  73 40 26 10 4D 93 C7 0A  @&.L....s@&.M...
00000040  09 73 40 26 10 4E AD 21  01 0A B3 40 26 10 55 0E  .s@&.N.!...@&.U.
00000050  75 15 40 26 10 56 16 47  09 7F EC 12 A3 A0 45 0B  u.@&.V.G.�....E.
00000060  04 62 00 00 00 00 DC 00                           .b......



          Ticks: 5203963 | Server -> Client |  ID: 04   Length: 2
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  04 FA                                             ..



          Ticks: 5203963 | Server -> Client |  ID: 57   Length: 110
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  57 42 36 F9 46 78 00 52  00 04 FA 60 01 91 0D 13  WB6.Fx.R...`....
00000010  0A 1C 00 00 04 09 02 01  40 26 10 A0 9E FD 05 08  ........@&......
00000020  30 40 26 10 A1 9F 01 16  07 4F 40 26 10 A2 95 15  0@&......O@&....
00000030  14 07 4F 40 26 10 A3 97  11 03 07 3D 40 26 10 A4  ..O@&......=@&..
00000040  0E 75 15 40 26 10 A5 17  F3 09 7F EC 12 7F A0 47  .u.@&.....�..�.G
00000050  0B 04 68 00 00 00 00 DC  00 04 FA 60 40 CC B7 53  ..h........`@..S
00000060  F3 00 01 00 40 23 A3 0E  10 0A 00 00 01 00        ....@#........



          Ticks: 5203963 | Server -> Client |  ID: 01   Length: 5
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  01 0D 1D 0A 18                                    .....



          Ticks: 5203963 | Server -> Client |  ID: 14   Length: 6
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  14 00 00 00 00 00                                 ......



          Ticks: 5203963 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 DC 40 23 A3 0E 40 0F  A0 6A 78 00 5D 00 04 FD  ..@#..@..jx.]...
00000010  F5 01 90 0D 2F 0A 0B 07  00 03 F3 00 01 40 26 30  ..../........@&0
00000020  1F 97 0B 03 07 53 40 26  30 20 93 CC 0D 06 6D 40  .....S@&0 ....m@
00000030  26 30 21 93 CD 13 06 6D  40 26 30 22 93 CB 04 06  &0!....m@&0"....
00000040  6D 40 26 30 23 93 C7 0A  06 6D 40 26 30 24 93 C6  m@&0#....m@&0$..
00000050  07 06 6D 40 26 30 2A 0E  75 15 7F EC 04 2B A0 3C  ..m@&0*.u.�..+.<
00000060  0B 04 51 00 00 00 00 DC                           ..Q.....



          Ticks: 5203963 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 04 FD F5 40 C5 08 F5  78 00 6F 00 04 FE 07 01  ....@...x.o.....
00000010  90 0D 2C 0A 09 07 02 04  1E 00 01 40 26 30 99 97  ..,........@&0..
00000020  0B 03 07 50 40 26 30 9A  95 15 14 07 D3 40 26 30  ...P@&0......@&0
00000030  9B 93 CD 13 08 45 40 26  30 9C 93 CC 0D 08 45 40  .....E@&0.....E@
00000040  26 30 9D 93 C7 0A 08 45  40 26 30 9E 93 CB 04 08  &0.....E@&0.....
00000050  45 40 26 30 9F 93 C6 07  08 45 40 26 30 A1 0E 75  E@&0.....E@&0..u
00000060  15 7F EC 03 E3 A0 48 0B                           .�....H.



          Ticks: 5203963 | Server -> Client |  ID: 04   Length: 2
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  04 63                                             .c

This packet starts in the middle of an ID: 77 and clobbers many packets

          Ticks: 4092406 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 0A 0A 00 04 84 0D 00  01 77 00 05 48 45 01 90  .........w..HE..
00000010  0D 32 0A 0A 00 04 84 0D  00 01 73 02 77 00 05 48  .2........s.w..H
00000020  45 01 90 0D 32 0A 0B 00  84 84 0D 00 01 73 03 22  E...2........s."
00000030  34 01 78 00 4E 00 08 C4  92 01 90 0D 24 0A 11 14  4.x.N.......$...
00000040  06 03 EA 00 01 40 3F 3C  F5 0E 75 15 40 3F 3D 02  .....@?<..u.@?=.
00000050  97 0F 03 06 A6 40 16 8F  0F 1D B9 06 40 16 1B 2D  .....@......@..-
00000060  13 EB 07 40 3F 3C F7 0F                           ...@?<..



          Ticks: 4093572 | Server -> Client |  ID: 52   Length: 383
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  52 01 7F DC E9 B7 A0 45  0B 04 6A 7F DC E9 B6 A0  R.�....E..j�....
00000010  41 10 04 7D 00 00 00 00  DC 00 08 C4 92 43 D3 D1  A..}.........C..
00000020  78 DF 00 0F 00 08 C4 92  03 F4 00 00 00 00 00 00  x...............
00000030  22 35 01 78 00 88 00 04  FA 5F 01 90 0D 11 0A 1A  "5.x....._......
00000040  00 02 03 F9 00 01 40 26  10 94 97 0B 03 07 20 40  ......@&...... @
00000050  26 10 95 95 15 14 07 DB  40 26 10 97 93 BF 0D 08  &.......@&......
00000060  A5 40 26 10 98 93 BE 04  08 A5 40 26 10 99 93 EE  .@&.......@&....
00000070  13 08 A5 40 26 10 9A 94  13 0A 08 A5 40 26 10 9B  ...@&.......@&..
00000080  93 EB 07 08 A5 40 26 10  9C 94 07 01 0B 3A 40 26  .....@&......:@&
00000090  10 9D 9B 76 02 0A B3 40  26 10 9E 0E 75 15 40 26  ...v...@&...u.@&
000000A0  10 9F 17 F3 09 7F EC 12  83 A0 47 0B 04 69 7F EC  .....�....G..i�.
000000B0  12 82 A0 3E 10 04 69 00  00 00 00 17 00 0C 00 04  ...>..i.........
000000C0  FA 5F 00 01 00 01 00 17  00 0C 00 04 FA 5F 00 01  ._..........._..
000000D0  00 02 00 DC 00 04 FA 5F  40 54 E8 A6 73 04 22 36  ......._@T..s."6
000000E0  01 22 37 01 AE 00 86 00  08 C4 92 01 90 00 00 22  ."7............"
000000F0  00 03 45 4E 55 00 4C 69  6C 53 70 75 64 00 00 00  ..ENU.LilSpud...
00000100  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
00000110  00 00 00 00 00 41 00 46  00 4B 00 20 00 74 00 65  .....A.F.K. .t.e
00000120  00 73 00 74 00 69 00 6E  00 67 00 2E 00 20 00 40  .s.t.i.n.g... .@
00000130  00 4C 00 6F 00 63 00 61  00 6C 00 54 00 65 00 63  .L.o.c.a.l.T.e.c
00000140  00 68 00 20 00 69 00 66  00 20 00 49 00 27 00 6D  .h. .i.f. .I.'.m
00000150  00 20 00 61 00 20 00 6E  00 75 00 69 00 73 00 61  . .a. .n.u.i.s.a
00000160  00 6E 00 63 00 65 00 2E  00 00 AE 00 FA 00 08 C4  .n.c.e..........
00000170  92 01 90 00 00 22 00 03  45 4E 55 00 4C 69 6C     ....."..ENU.Lil



          Ticks: 4093572 | Server -> Client |  ID: 53   Length: 2
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  53 70                                             Sp



          Ticks: 4093572 | Server -> Client |  ID: 75   Length: 35
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  75 64 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ud..............
00000010  00 00 00 00 00 00 00 00  00 00 74 00 65 00 73 00  ..........t.e.s.
00000020  74 00 69                                          t.i



          Ticks: 4093572 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 6E 00 67 00 20 00 74  00 65 00 73 00 74 00 69  .n.g. .t.e.s.t.i
00000010  00 6E 00 67 00 20 00 74  00 65 00 73 00 74 00 69  .n.g. .t.e.s.t.i
00000020  00 6E 00 67 00 20 00 74  00 65 00 73 00 74 00 69  .n.g. .t.e.s.t.i
00000030  00 6E 00 67 00 20 00 74  00 65 00 73 00 74 00 69  .n.g. .t.e.s.t.i
00000040  00 6E 00 67 00 20 00 74  00 65 00 73 00 74 00 69  .n.g. .t.e.s.t.i
00000050  00 6E 00 67 00 20 00 74  00 65 00 73 00 74 00 69  .n.g. .t.e.s.t.i
00000060  00 6E 00 67 00 20 00 74                           .n.g. .t



          Ticks: 4093578 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 65 00 73 00 74 00 69  00 6E 00 67 00 20 00 74  .e.s.t.i.n.g. .t
00000010  00 65 00 73 00 74 00 69  00 6E 00 67 00 20 00 74  .e.s.t.i.n.g. .t
00000020  00 65 00 73 00 74 00 69  00 6E 00 67 00 20 00 74  .e.s.t.i.n.g. .t
00000030  00 65 00 73 00 74 00 69  00 6E 00 67 00 20 00 74  .e.s.t.i.n.g. .t
00000040  00 65 00 73 00 74 00 69  00 6E 00 67 00 20 00 74  .e.s.t.i.n.g. .t
00000050  00 65 00 73 00 74 00 00  73 00 6C 00 00 09 DC 01  .e.s.t..s.l.....
00000060  00 00 00 00 00 00 00 00                           ........



          Ticks: 4094304 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 00 00 00 00 C1 00 32  FF FF FF FF FF FF 00 03  .......2........
00000010  B2 00 03 00 07 A2 7D 53  79 73 74 65 6D 00 00 00  ......}System...
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
00000030  00 00 00 00 00 00 00 77  00 05 48 45 01 90 0D 32  .......w..HE...2
00000040  0A 0A 00 80 84 0D 00 01  77 00 05 48 45 01 90 0D  ........w..HE...
00000050  32 0A 0A 00 80 84 0D 00  01 77 00 05 48 45 01 90  2........w..HE..
00000060  0D 32 0A 09 00 80 84 0D                           .2......



          Ticks: 4097588 | Server -> Client |  ID: 00   Length: 104
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  00 01 77 00 05 48 45 01  90 0D 32 0A 09 00 07 84  ..w..HE...2.....
00000010  0D 00 01 73 01 6E 00 05  48 45 00 05 00 05 00 01  ...s.n..HE......
00000020  00 01 01 73 02 73 03 6C  00 00 00 00 00 03 00 00  ...s.s.l........
00000030  00 00 00 00 00 00 00 00  00 00 78 00 4E 00 08 C4  ..........x.N...
00000040  92 01 90 0D 24 0A 11 14  02 03 EA 80 01 40 3F 3C  ....$........@?<
00000050  F5 0E 75 15 40 3F 3D 02  97 0F 03 06 A6 40 16 8F  ..u.@?=......@..
00000060  0F 1D B9 06 40 16 1B 2D                           ....@..-



          Ticks: 4097588 | Server -> Client |  ID: 13   Length: 10
          0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F
          -- -- -- -- -- -- -- --  -- -- -- -- -- -- -- --
00000000  13 EB 07 40 3F 3C F7 0F  52 01                    ...@?<..R.

I have more samples if needed but I've already made this post a wall. Aside from the weirdly offset packets with missing bytes above sometimes the CUO packet dump just logs a large string of NUL.
Screenshot 2024-05-18 133028

I thought the lock would help but I think its a combination of the buffer array and the decompression causing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants