Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » UI deadlock when typing character with SWTKeyboardStrategy
UI deadlock when typing character with SWTKeyboardStrategy [message #40829] Fri, 26 June 2009 17:23 Go to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
Hi again,

As you know, I'm using the typeText methods to simulate real user input
and with the AltGr problem we are having, I started using the EN_US
keyboard layout for the tests. I found out that the layout couldn't
write the ' character with AWTKeyboardStrategy, so I started using
SWTKeyboardStrategy; problem is, I'm getting UI deadlock.

First, Display.post synchronize on the Device class (Display, line 2900)
then obtains the display pointer with OS.GDK_DISPLAY() (Display, line
2904). This method then lock on a field of the OS class and that's where
the WorkbenchTestable thread (SWTBot's thread) holds.

Meanwhile, in the UI thread, a paint event has been dispatched by SWT
using OS.gtk_main_do_event (OS, line 5783) which holds the lock on the
OS field. During the paint event handling, the widget being painted
tries to access something (could be the GC, system color, anything, I
got the deadlocks at different places) in the Display class: the class
check for validity and tries to synchronize on the Device class before
doing so, but this lock is hold by Display.post, on another thread. DEADLOCK

I tried wrapping up the calls to my calls to typeText into syncExec and
the text that was typed only appeared at the end of the exec. If a
problem happens (and it did) then the UI is frozen.

For now, I have fallen back to a custom AWTStrategy which map ' to
KeyEvent.VK_QUOTE, but if anyone has any ideas about this issue, I would
appreciate it.

Regards,
P
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #40860 is a reply to message #40829] Fri, 26 June 2009 17:45 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
I'd recommend opening a bug against SWT if you're sure that's the case.
I'm not on GTK and can't reproduce this.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr

On 26/6/09 22:53, Pascal Gelinas wrote:
> Hi again,
>
> As you know, I'm using the typeText methods to simulate real user input
> and with the AltGr problem we are having, I started using the EN_US
> keyboard layout for the tests. I found out that the layout couldn't
> write the ' character with AWTKeyboardStrategy, so I started using
> SWTKeyboardStrategy; problem is, I'm getting UI deadlock.
>
> First, Display.post synchronize on the Device class (Display, line 2900)
> then obtains the display pointer with OS.GDK_DISPLAY() (Display, line
> 2904). This method then lock on a field of the OS class and that's where
> the WorkbenchTestable thread (SWTBot's thread) holds.
>
> Meanwhile, in the UI thread, a paint event has been dispatched by SWT
> using OS.gtk_main_do_event (OS, line 5783) which holds the lock on the
> OS field. During the paint event handling, the widget being painted
> tries to access something (could be the GC, system color, anything, I
> got the deadlocks at different places) in the Display class: the class
> check for validity and tries to synchronize on the Device class before
> doing so, but this lock is hold by Display.post, on another thread.
> DEADLOCK
>
> I tried wrapping up the calls to my calls to typeText into syncExec and
> the text that was typed only appeared at the end of the exec. If a
> problem happens (and it did) then the UI is frozen.
>
> For now, I have fallen back to a custom AWTStrategy which map ' to
> KeyEvent.VK_QUOTE, but if anyone has any ideas about this issue, I would
> appreciate it.
>
> Regards,
> P
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #40891 is a reply to message #40860] Fri, 26 June 2009 17:58 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
On 26/6/09 23:15, Ketan Padegaonkar wrote:
>
> For now, I have fallen back to a custom AWTStrategy which map ' to
> KeyEvent.VK_QUOTE, but if anyone has any ideas about this issue, I would
> appreciate it.

I'm considering using a composite strategy that switches between awt and
swt implementations for these kind of quirks across swt and jvm versions.

I don't have any concrete ideas on how to implement this, but I'm open
to suggestions on how this can be improved for better.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #40922 is a reply to message #40860] Fri, 26 June 2009 18:42 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
damn you're right, I forgot it might be platform specific... I'll pay a
visit to the SWT team ;)
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #40952 is a reply to message #40860] Fri, 26 June 2009 20:19 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
Solved the issue :D

I wrapped each individual call of Display.post in the
SWTKeyboardStrategy in a syncExec: Display.post then executes on the UI
Thread preventing the deadlocks.
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #40982 is a reply to message #40860] Mon, 29 June 2009 12:39 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
I found a bug entry in Eclipse about this one. It was fixed on 20080926
so I should probably get a newer build.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=247069
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #41013 is a reply to message #40982] Mon, 29 June 2009 13:45 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
This was fixed in Nov 2008, are you still on an M-build ?

-- Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr


On 29/6/09 18:09, Pascal Gelinas wrote:
> I found a bug entry in Eclipse about this one. It was fixed on 20080926
> so I should probably get a newer build.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=247069
Re: UI deadlock when typing character with SWTKeyboardStrategy [message #41075 is a reply to message #41013] Mon, 29 June 2009 17:24 Go to previous message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
Weird enough, I am. This is the full version given by eclipse:
Version: 3.4.2
Build id: M20090211-1700.
That is, up until this morning where I switched to 3.5.
Previous Topic:MultiPageEditor Support
Next Topic:How to relaunch a single test within Eclipse
Goto Forum:
  


Current Time: Thu Mar 28 19:24:07 GMT 2024

Powered by FUDForum. Page generated in 0.02480 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top