Bug 479862

Summary: Closing the session with at least one editor not initialized can lead to a race condition
Product: [Modeling] Sirius Reporter: Yvan Lussaud <yvan.lussaud>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: esteban.dugueperoux
Version: 2.0.5Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Yvan Lussaud CLA 2015-10-15 10:11:21 EDT
I'm using the v2.0.7

step to reproduce (it can be a bit random even with this steps):

open an Eclipse
open more than one diagram
close the Eclipse
reopen it (do not change the active Editor)
call Session.close() or IEditingSession.close()

If at some point an editor that was not initialized get the focus. It will start initializing while the Session is closing in the background.

A fix would be to close not initialized Editor first or the Editor with the focus last.
Comment 1 Esteban DUGUEPEROUX CLA 2015-11-05 11:54:48 EST
Indeed this is possible since the session closing is not thread safe, neither session opening. We should make session opening and closing thread safe, and prevents session reopening for a same session instance, i.e. once a session is closed to reopen it, it must be recreated through SessionManager.getSession().