• Post Reply Bookmark Topic Watch Topic
  • New Topic

How a Thread went to sleep  RSS feed

 
sonu arora
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
in my program i have created a program , its a long processing program
reading from a number of files and then inserting into database, i m using connection pool and acquire a connection in the start,
problem is some times program runs and some times it just hangs some where in the middle.
i m entring a lots of information and exception catching in a log file for this program.
when the programs runs successfully , the log file size is in MB's
but when it hangs and no exception in the log file , entries just stops and no further entries in the log file.
1. when it hangs i can't delete the log file also OS says shared violation or file is being used by other process.
2. i also checked the the status of this thread with isAlive(). it returns me true all the time
successfull job takes 10 mins to finish but when it hangs it does not stop means thread does not exit and it remains alive w/o doing any thing.

when i conclude is Thread went into sleep mode may be for permanently, bcz no other job or Thread starts when this job is running .
i want to ask is how can be a thread went to sleep w/o calling a sleep method on it.
plz suggest
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Threads don't just "go to sleep." It's quite possible that there's a deadlock. A deadlock is when one thread is holding lock A and wants lock B, and a second thread is holding lock B and wants lock A; they both wait forever to get access to the resource they want.
To see what's happening with your program when it hangs, you can send it a stack trace signal. Run the program from the console, and when it hangs, just press Control-\ (on UNIX) or Control-Break (on Windows.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!