Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Shi Jun Zhang
On 12/9/2013 10:01 PM, Peter Levart wrote: On 12/09/2013 11:12 AM, Daniel Fuchs wrote: On 12/9/13 9:58 AM, Peter Levart wrote: On 12/09/2013 09:51 AM, Shi Jun Zhang wrote: On 12/9/2013 4:28 PM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunders

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Shi Jun Zhang
On 12/9/2013 8:04 PM, Peter Levart wrote: On 12/09/2013 10:50 AM, Shi Jun Zhang wrote: On 12/9/2013 4:40 PM, Peter Levart wrote: On 12/09/2013 09:28 AM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is no

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Peter Levart
On 12/09/2013 11:12 AM, Daniel Fuchs wrote: On 12/9/13 9:58 AM, Peter Levart wrote: On 12/09/2013 09:51 AM, Shi Jun Zhang wrote: On 12/9/2013 4:28 PM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not r

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Peter Levart
On 12/09/2013 10:50 AM, Shi Jun Zhang wrote: On 12/9/2013 4:40 PM, Peter Levart wrote: On 12/09/2013 09:28 AM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization,

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Daniel Fuchs
On 12/9/13 9:58 AM, Peter Levart wrote: On 12/09/2013 09:51 AM, Shi Jun Zhang wrote: On 12/9/2013 4:28 PM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization, we c

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Shi Jun Zhang
On 12/9/2013 4:40 PM, Peter Levart wrote: On 12/09/2013 09:28 AM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization, we can make CustomerFormatter.format not syn

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Peter Levart
On 12/09/2013 09:51 AM, Shi Jun Zhang wrote: On 12/9/2013 4:28 PM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization, we can make CustomerFormatter.format not sy

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Shi Jun Zhang
On 12/9/2013 4:28 PM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization, we can make CustomerFormatter.format not synchronized and not call super.format, the dea

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Peter Levart
On 12/09/2013 09:28 AM, Peter Levart wrote: On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization, we can make CustomerFormatter.format not synchronized and not call super.format, the d

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-09 Thread Peter Levart
On 12/09/2013 08:02 AM, Shi Jun Zhang wrote: Peter, I think you are misunderstanding this problem. This deadlock is not related to the formatter synchronization, we can make CustomerFormatter.format not synchronized and not call super.format, the deadlock still happens. I'm not saying that

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-08 Thread Shi Jun Zhang
On 12/6/2013 12:53 AM, Jason Mehrens wrote: Shi Jun Zhang, This problem is like hooking up your sink drain to your sink faucet. Even if it you can get it to work you still would not want to use it. In your code example you could just pre-pend the thread name to the formatter string and ret

RE: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-05 Thread Jason Mehrens
Shi Jun Zhang, This problem is like hooking up your sink drain to your sink faucet. Even if it you can get it to work you still would not want to use it. In your code example you could just pre-pend the thread name to the formatter string and return it. However, if you really, really, r

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-05 Thread Peter Levart
On 12/05/2013 07:54 AM, Shi Jun Zhang wrote: On 11/30/2013 12:05 AM, Daniel Fuchs wrote: On 11/29/13 4:56 PM, Alan Bateman wrote: On 29/11/2013 10:08, Daniel Fuchs wrote: However, removing or just moving the lock around might well introduce new unknown issues - so it will need to be carefu

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-12-04 Thread Shi Jun Zhang
On 11/30/2013 12:05 AM, Daniel Fuchs wrote: On 11/29/13 4:56 PM, Alan Bateman wrote: On 29/11/2013 10:08, Daniel Fuchs wrote: However, removing or just moving the lock around might well introduce new unknown issues - so it will need to be carefully anaIyzed, and I am not sure it can/should b

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-29 Thread Daniel Fuchs
On 11/29/13 4:56 PM, Alan Bateman wrote: On 29/11/2013 10:08, Daniel Fuchs wrote: However, removing or just moving the lock around might well introduce new unknown issues - so it will need to be carefully anaIyzed, and I am not sure it can/should be attempted in a minor JDK release. Yes, we h

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-29 Thread Alan Bateman
On 29/11/2013 10:08, Daniel Fuchs wrote: However, removing or just moving the lock around might well introduce new unknown issues - so it will need to be carefully anaIyzed, and I am not sure it can/should be attempted in a minor JDK release. Yes, we have to be very careful as the logging cod

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-29 Thread Daniel Fuchs
On 11/29/13 10:49 AM, Shi Jun Zhang wrote: On 11/29/2013 5:25 PM, Daniel Fuchs wrote: On 11/29/13 7:19 AM, Shi Jun Zhang wrote: On 11/29/2013 1:21 AM, Daniel Fuchs wrote: Hi Shi Jun Zhang, I agree with Peter. It is strange that CustomFormatter calls Logger.log. This looks like the source of t

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-29 Thread Shi Jun Zhang
On 11/29/2013 5:25 PM, Daniel Fuchs wrote: On 11/29/13 7:19 AM, Shi Jun Zhang wrote: On 11/29/2013 1:21 AM, Daniel Fuchs wrote: Hi Shi Jun Zhang, I agree with Peter. It is strange that CustomFormatter calls Logger.log. This looks like the source of the deadlock. Hi Daniel, I explained why w

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-29 Thread Daniel Fuchs
On 11/29/13 7:19 AM, Shi Jun Zhang wrote: On 11/29/2013 1:21 AM, Daniel Fuchs wrote: Hi Shi Jun Zhang, I agree with Peter. It is strange that CustomFormatter calls Logger.log. This looks like the source of the deadlock. Hi Daniel, I explained why we call Logger.log in CustomerFormatter in an

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-28 Thread Shi Jun Zhang
On 11/29/2013 1:21 AM, Daniel Fuchs wrote: Hi Shi Jun Zhang, I agree with Peter. It is strange that CustomFormatter calls Logger.log. This looks like the source of the deadlock. Hi Daniel, I explained why we call Logger.log in CustomerFormatter in another mail replied to Peter, CustomerForma

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-28 Thread Shi Jun Zhang
On 11/28/2013 8:13 PM, Peter Levart wrote: On 11/28/2013 08:53 AM, Shi Jun Zhang wrote: The problem is that we use a logger in CustomerFormatter and this causes Logger.log call Logger.log itself. As FileHandler.publish and StreamHandler.publish is synchronized, but the iteration to call publis

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-28 Thread Daniel Fuchs
Hi Shi Jun Zhang, I agree with Peter. It is strange that CustomFormatter calls Logger.log. This looks like the source of the deadlock. The Logger API can be customized in many ways - and when you can plugin custom classes and objects you can introduce new opportunity for deadlocks. Concerning t

Re: Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-28 Thread Peter Levart
On 11/28/2013 08:53 AM, Shi Jun Zhang wrote: The problem is that we use a logger in CustomerFormatter and this causes Logger.log call Logger.log itself. As FileHandler.publish and StreamHandler.publish is synchronized, but the iteration to call publish method for all handlers in Logger.log is n

Deadlock between FileHandler and ConsoleHandler when using customized formatter

2013-11-27 Thread Shi Jun Zhang
Hi, We get a deadlock between java.util.logging.FileHandler and java.util.logging.ConsoleHandler when we are using a customized formatter in these handlers. Here is the simple test case. http://cr.openjdk.java.net/~zhangshj/deadlockInHandlers/deadlockInHandlers.zip Run "java -Djava.util.lo