Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What might be the cause of "long monitor contention event with owner method"?

Tags:

I'm a beginner and I have an assignment of making a basic chat app of two clients and a server exchanging strings which are destination+message.

I have written some code, but when I use it I'm getting this "long monitor contention event with owner method" at the other end.

Can anyone help me with how this can occur? Or can anyone tell me the cause of this in general?

like image 426
Ahmed Samy Avatar asked Mar 16 '15 09:03

Ahmed Samy


1 Answers

It is caused by one thread holding a monitor / mutex for a long time, and blocking other threads. For example:

synchronized(lock) {     /* do something that takes a long time */ } 

In this case, "a long time" is 100 milliseconds or more. (This pull request is where this check was added.)

It is a warning ... but you would be advised to look into it as it is likely to lead your application being unresponsive.

In general, the cure is to reduce the length of time your application needs to hold mutexes. But, without seeing your code, it is hard to advise how you would do this.

like image 195
Stephen C Avatar answered Jan 01 '23 18:01

Stephen C