int-72h / oftoast1

(DEPRECATED) Open Fortress frontend using TVN.
GNU General Public License v3.0
6 stars 10 forks source link

work function becomes inifinitely recursive #20

Closed Jan200101 closed 2 years ago

Jan200101 commented 2 years ago

An issue has been reported on Linux where every thread hit the recursion limit.

This is caused by work() indiscriminately calling itself upon an exception being thrown, now matter what kind.

https://github.com/int-72h/of-jam/blob/1cf3eb836c15ce418ca25c65f67a7fa8c00b897f/ofjam/gui.py#L507-L508

I am unaware how many different exceptions could be thrown, but I suggesting replacing it with a while loop and a counter

e.g.

def work(arr):
    tries = 0
    while (true):
        try:
            # File download logic

            return # we are done, we can leave
        except Exception as e:
            tries += 1
            if tries != 10:
                continue # something went wrong, lets try again
            raise e

to sum the code up it keeps trying the download logic up to 10 times, and then propagates whatever exception was given.

Not doing recursion prevents us from hitting the recursion limit

int-72h commented 2 years ago

@Tholp1 @brysondev did any of you add this?

brysondev commented 2 years ago

Yeah it was Fen, I agreed to it just running until the recursion limit cuz it would still run into issues downloading files.

People with shitternet are going to have issues regardless of how we do this so lets just add this, and then if people have issues give them a zip link.

brysondev commented 2 years ago

https://github.com/int-72h/of-jam/pull/21