dan200 / ComputerCraft

Programmable Computers for Minecraft
Other
981 stars 198 forks source link

programs that use the Parallel feature keeps creating more threads and doesn't stop #609

Open AngryCarrot789 opened 3 years ago

AngryCarrot789 commented 3 years ago

fairly certain this is a bug, because a program that uses the Parallel feature sometimes wont do this, but randomly starts doing it. this is what it looks like when you terminate the program: image

this example it only ran for about 20 minutes and when terminating that program, the thread usage for the server drops by a bit (i assume for every time it says "parallel:22" thats a thread or coroutine thread being killed)

the program in mind is the bigreactor controller (https://pastebin.com/RCPEHmxs)

SquidDev commented 3 years ago

Self promotion warning, but if you're on 1.12 or later, you may want to switch to CC: Tweaked which at least fixes the thread-usage issue.

The program looks a bit odd in general though, in that homepage calls call_homepage which then calls homepage again - hence the massively nested set of parallel APIs. It's not broken, but (aside from thread usage), does mean the program will get progressively slower the longer it runs.

AngryCarrot789 commented 3 years ago

im still running a server on tekkit (1.6.4) so i can't switch to CC tweake :( unless CC tweaked doesn't have new blocks and stuff, then maybe it could work

i think i might try and modify the that program though and fix that homepage situation, and somehow block users from using that specific pastebin (or try and recompile computercraft to fix the thread issue)

SquidDev commented 3 years ago

Ahh, if you're on 1.6.4 then I'm afraid you're probably out of luck. We only have source code available for the 1.8.9 versions (and later), so recompiling isn't an option either.

You could probably write a core mod to replace the Lua runtime, but I don't think it's really worth it. Providing an alternative big-reactor program and blocking people from using that one (I'd just run a grep on the computer directory for "by jaranvil aka jared314" or something) is probably your best bet :/.