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

LiveSource watcherThread not finishing gracefully #260

Open
ChitaAPC opened this issue Jun 29, 2021 · 1 comment
Open

LiveSource watcherThread not finishing gracefully #260

ChitaAPC opened this issue Jun 29, 2021 · 1 comment
Labels

Comments

@ChitaAPC
Copy link

ChitaAPC commented Jun 29, 2021

When parsing a live match, the watcherThread (started in skadistats.clarity.source.LiveSource) never terminates, which means the resources for the file are not fully freed up. This is having two effects:
1 - Cannot delete files even after the main clarity thread is completed
2 - [Not 100% sure this is actually happening] Multiple Live files within the same application (parsed sequentially) are not working as intended since the watcher thread persists and points to the wrong source file.

I've made this ugly work-around fix on my end for now, which resolved the issue(s). I've added that to the code once the main clarity parsing thread completes:

        } finally {
            Set<Thread> setOfThread = Thread.getAllStackTraces().keySet();
            Thread threadToInterupt = null;
            for (Thread th : setOfThread){
                if (th.getName().equals("clarity-livesource-watcher")){
                    threadToInterupt = th;
                    threadToInterupt.setUncaughtExceptionHandler(new IgnoreInteruptExceptionHandler());
                }
            }
            if (Objects.nonNull(threadToInterupt)){
                threadToInterupt.interrupt();
            }
        }

This is obvly not an elegant solution so I thought I would flag up here.

Just to confirm, I am calling LiveSource.Close() which as far as I can tell from the thread window it is working with everything else.

Thanks again for the awesome work!

@spheenik
Copy link
Member

It's an interesting bug! It's been a while since I wrote the LiveSource, and even after looking at the code for a while, I'm not sure what the problem is.
I have some vectors for further investigation though - I'll keep you updated.

@spheenik spheenik added the bug label Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants