ramyakalyan / google-refine

Automatically exported from code.google.com/p/google-refine
0 stars 0 forks source link

Deadlock between autosave thread and history code #559

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Different sections of the code are acquiring locks in different orders, 
resulting in the following deadlock.  One is holding a lock on History and 
trying to lock Project while the other is holding Project while trying to lock 
History.

Name: pool-1-thread-16
State: BLOCKED on com.google.refine.model.Project@4e3a2053 owned by: autosave
Total blocked: 1  Total waited: 0

Stack trace: 
 com.google.refine.history.HistoryEntry.apply(HistoryEntry.java:128)
com.google.refine.history.History.addEntry(History.java:131)
   - locked com.google.refine.history.History@242e983d
com.google.refine.process.QuickHistoryEntryProcess.performImmediate(QuickHistory
EntryProcess.java:75)
com.google.refine.process.ProcessManager.queueProcess(ProcessManager.java:82)
com.google.refine.commands.recon.ReconJudgeOneCellCommand.doPost(ReconJudgeOneCe
llCommand.java:100)
com.google.refine.RefineServlet.service(RefineServlet.java:177)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

Name: autosave
State: BLOCKED on com.google.refine.history.History@242e983d owned by: 
pool-1-thread-16
Total blocked: 3  Total waited: 5

Stack trace: 
 com.google.refine.history.History.save(History.java:277)
com.google.refine.model.Project.saveToWriter(Project.java:158)
com.google.refine.model.Project.saveToOutputStream(Project.java:140)
com.google.refine.io.ProjectUtilities.saveToFile(ProjectUtilities.java:98)
com.google.refine.io.ProjectUtilities.save(ProjectUtilities.java:65)
   - locked com.google.refine.model.Project@4e3a2053
   - locked java.lang.Class@472ebf9a
com.google.refine.io.FileProjectManager.saveProject(FileProjectManager.java:219)
com.google.refine.ProjectManager.saveProjects(ProjectManager.java:296)
com.google.refine.ProjectManager.save(ProjectManager.java:206)
com.google.refine.RefineServlet$AutoSaveTimerTask.run(RefineServlet.java:91)

Original issue reported on code.google.com by tfmorris on 14 Apr 2012 at 1:11

GoogleCodeExporter commented 8 years ago
In r2538 locks are now acquired in the same order in both pieces of code so 
that competing threads won't deadlock.

Original comment by tfmorris on 30 Aug 2012 at 4:24

GoogleCodeExporter commented 8 years ago

Original comment by tfmorris on 18 Sep 2012 at 3:05