Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Hibernate hangs on calling flush
PostPosted: Thu Mar 02, 2017 12:38 pm 
Newbie

Joined: Thu Mar 02, 2017 12:34 pm
Posts: 2
I have a program running from tomcat 8, postgresql database is used locally.

The program is doing some operations and ran flush several times successfully. But at a certain point in the program it just hangs:
em.flush();
where em is EntityManager and also debugger shows that its inside of the SocketOutputStream.socketWrite function never getting out of it.

How can I fix issue or find the reason?


Top
 Profile  
 
 Post subject: Re: Hibernate hangs on calling flush
PostPosted: Thu Mar 02, 2017 1:24 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1228
It can be either because:

1. You have a bug in the JDC Driver
2. You submitted a huge load to the DB, so the Connection is stuck waiting for an answer

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Hibernate hangs on calling flush
PostPosted: Fri Mar 03, 2017 2:35 am 
Newbie

Joined: Thu Mar 02, 2017 12:34 pm
Posts: 2
vlad wrote:
It can be either because:

1. You have a bug in the JDC Driver
2. You submitted a huge load to the DB, so the Connection is stuck waiting for an answer


I guess the 2nd case might be true. Though not sure why. I'm debugging it and seeing that it has stuck on execution of insertion operations (there are around 3600 of them).
it worked well with first 1055 insertions and the next one stuck in the loop:
executeActions function of ActionQueue.

Is there any way to figure out why it is the case that it hangs there?


Top
 Profile  
 
 Post subject: Re: Hibernate hangs on calling flush
PostPosted: Fri Mar 03, 2017 2:48 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1228
Why don't you just break it into multiple batches which clear the Session in between two batch executions and commit the transactions after N batches?

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.