public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Re: Insight freezes on Windows 7
@ 2013-03-22  8:01 Roland Schwingel
  2013-03-22  9:33 ` Fedin Pavel
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Schwingel @ 2013-03-22  8:01 UTC (permalink / raw)
  To: insight

Hi Pavel...


 >   I am trying to use Insight on Windows 7, and have problems. Under
 > certain conditions it freezes and GUI stops responding.
I am a regular user of insight on Windows 7 64bit. I use insight both 
for 32 and 64bit mingw targets and do not have hangs.

 >   This happens after you open and close target selection dialog, and
 > then do one of the following:
 > a) Close main window.
 > b) Call any function which gets reference to Windows HWnd (for example
 > "Print setup" dialog), or open "Select file" dialog (File->Open... for
 > example).
 > c) Use 'Connect to target' option with no target set up. In this case it
 > opens target selection dialog, then if you cancel it it should open
 > MessageBox(), which freezes.
I am not using open target but will try to reproduce this.

Which tcl/tk version do you use? I am using a stock tcl/tk 8.6.0. All 
versions before did had serious problems for me on windows 64bit. I am 
quite happy with 8.6

Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insight freezes on Windows 7
  2013-03-22  8:01 Insight freezes on Windows 7 Roland Schwingel
@ 2013-03-22  9:33 ` Fedin Pavel
  0 siblings, 0 replies; 3+ messages in thread
From: Fedin Pavel @ 2013-03-22  9:33 UTC (permalink / raw)
  To: Roland Schwingel; +Cc: insight

On 22.03.2013 12:00, Roland Schwingel wrote:
> >   I am trying to use Insight on Windows 7, and have problems. Under
> > certain conditions it freezes and GUI stops responding.
> I am a regular user of insight on Windows 7 64bit. I use insight both 
> for 32 and 64bit mingw targets and do not have hangs.
>
> I am not using open target but will try to reproduce this.
>
> Which tcl/tk version do you use? I am using a stock tcl/tk 8.6.0. All 
> versions before did had serious problems for me on windows 64bit. I am 
> quite happy with 8.6
  I have just checked out and built Insight. So i am using bundled 
version of tcl/tk.
  By this time i have found the reason for the problem. Opening a serial 
port inside TCL is tricky. I noticed that it uses overlapped mode, and 
also it creates separate thread for writing. Also looks like it 
registers the handle within main loop in order to support event-based 
reading (at least i expect it to be implemented in such a way). I have 
noticed that write implementation is very hacky (it uses 
TerminateThread() in order to stop the thread, which is not good at all).
  Currently i suggest that there is some mis-synchronization between 
this mechanism and main event loop which is triggered by quick 
open-close sequence. When i debugged the problem even a single printf() 
in C code after opening port handle appeared to cure it. Such behavior 
(and also the fact that on another machine it is not reproduced)  
usually clearly indicates some kind of races.
  Changing RWDR open mode to RDONLY fixes the problem. I will use this 
as a workaround, complete fix of TCL interpreter isn't my goal because 
i'm not going to use it outside of Insight.
  And one more note about port listing. It works incorrectly if your 
ports are not numbered in a sequence. This is quite normal situation 
with USB-Serial adapters which are quite widespread nowadays. For 
example, on my system i happen to have COM1, COM9 and COM10. Since i 
don't have COM5 the enumeration lists only COM1.
  I think it would be more correct to enumerate serial ports via 
registry or DeviceManager (or whatever it is called - i forgot) API. 
Unfortunately i totally forgot how to do it by now - i have done this 
once several years ago. But one can take a look at, for example,  
http://www.codeproject.com/Articles/14469/Simple-Device-Manager in order 
to learn how to do device enumeration on Windows.

-- 
  Kind regards
  Pavel Fedin
  Expert engineer, Samsung R&D Institute Rus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Insight freezes on Windows 7
@ 2013-03-22  7:23 Fedin Pavel
  0 siblings, 0 replies; 3+ messages in thread
From: Fedin Pavel @ 2013-03-22  7:23 UTC (permalink / raw)
  To: insight

  Hello!

  I am trying to use Insight on Windows 7, and have problems. Under 
certain conditions it freezes and GUI stops responding.
  This happens after you open and close target selection dialog, and 
then do one of the following:
a) Close main window.
b) Call any function which gets reference to Windows HWnd (for example 
"Print setup" dialog), or open "Select file" dialog (File->Open... for 
example).
c) Use 'Connect to target' option with no target set up. In this case it 
opens target selection dialog, then if you cancel it it should open 
MessageBox(), which freezes.

  Using sequential division method i figured out that the problem pops 
up because of port_list TCL function. If you comment it out, the problem 
disappears. More precisely, the problem is caused by the sequence:
if {[catch { set fd [::open COM$i: RDWR] } msg]} { <--- this succeeds
....
close $fd <--- Close the stream.
...
  It's even more strange that if you add for example 'puts "Ok!"' right 
before close call the problem disappears.

  This problem reproduces on all three possible flavours:
1. Cygwin
2. MinGW 32-bit
3. MinGW 64-bit.

  Yes, i have to patch the source in order to build (2) and (3).
  The problem is well reproducible on both last release (from 2009) and 
current CVS code.
  Right now i'm digging into Tcl_FSOpenFileChannel() in order to try to 
understand the true cause of the problem.

  Can anyone give me a hint ? Does anybody run on Win7 too ?

  P.S. Sorry if this is wrong list, i tried to post to insight-pr twice, 
but first time the message was rejected with "do not send spam to us" 
notice, second time with "this is wrong list" notice. I hope this time 
will work.

-- 
  Kind regards
  Pavel Fedin
  Expert engineer, Samsung R&D Institute Rus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-22  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22  8:01 Insight freezes on Windows 7 Roland Schwingel
2013-03-22  9:33 ` Fedin Pavel
  -- strict thread matches above, loose matches on Subject: below --
2013-03-22  7:23 Fedin Pavel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).