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

Synchronization Issue #98

Open
waynchi opened this issue Nov 3, 2013 · 8 comments
Open

Synchronization Issue #98

waynchi opened this issue Nov 3, 2013 · 8 comments

Comments

@waynchi
Copy link

waynchi commented Nov 3, 2013

Hi, I implemented the synchronization steps and all of that worked great for the most part.
However, there was a portion of my program that was unable to run because of the synchronization blocks. It would just halt my program completely. How do we get around this? (I did use synch blocks and created synched ArrayLists, it just completely halts my program.)

@lshiffer
Copy link

lshiffer commented Nov 3, 2013

I had the same issue. Synched everything and program wouldn't even load the gui, just output three lines from the Market. Removing the sync around the iteration in the Market's scheduler fixed the issue but wondering how to have that sync without the hold up.

@BachDinh1994
Copy link

Does anyone know how much extra credit is given for incorporating Astar into this project?

@EliteSoba
Copy link

Well I can't say for certain without playing around with your code to pinpoint the exact issue, but in a broader sense this problem will happen when you have a synchronized block of code that waits on another synchronized block of code to finish and both blocks of code are monitoring the same data.

And Bach, that question is completely unrelated to the issue at hand, but I don't quite know either.

@waynchi
Copy link
Author

waynchi commented Nov 3, 2013

Yea, that's what I kind of figured. I don't really know a proper fix though...

@EliteSoba
Copy link

You could just start removing synchronized blocks and see when you stop getting errors, and then check to see why that synchronized block would cause your program to die.

@lshiffer
Copy link

lshiffer commented Nov 4, 2013

Can you locate where the issue is?

I fixed my problem by changing the synchronized block to a try/catch.

@waynchi
Copy link
Author

waynchi commented Nov 4, 2013

Yea, I'm just trying removing and changing things, but I don't really get WHY it's just dying

@diegovb
Copy link

diegovb commented Nov 4, 2013

This happens when there are "synchronization loops" where thread A is waiting to access data locked by thread B, but thread B is waiting to access data locked by thread A. What you can do is open your program in debug mode, and when it get frozen, pause the program and look at the stacks of each of your threads. It will show what threads are waiting for data, and what threads are holding said data. That can help you figure it out.

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

5 participants