MCJack123 / craftos2

A fast, modern, and feature-filled ComputerCraft emulator written in C++.
https://www.craftos-pc.cc
Other
230 stars 27 forks source link

Repeated Websocket.close calls crash the computer thread #336

Closed MineRobber9000 closed 9 months ago

MineRobber9000 commented 10 months ago

Describe the bug As the title indicates, repeatedly attempting to close a websocket crashes the computer thread.

To Reproduce Steps to reproduce the behavior:

  1. Create a websocket pointing to some URL (example: wss://ccws.skystuff.cc/connect/foobar)
  2. Close it.
  3. Repeat from step 2.

Expected behavior Nothing should happen. The close method in actual CC:Tweaked 1.106.1 (the version CraftOS-PC claims to be) never calls checkOpen so the attempt to use a closed file error should never appear, and the computer thread should certainly not crash.

Actual behavior The first time, it closes cleanly. The second time, an error is raised for an operation on a closed file. The third time, the computer thread crashes with the exception "Exception on computer thread: device or resource busy: device or resource busy".

Environment (please complete the following information):