bugKawa - Bugs: bug #16313, Kawa repl in Windows keeps crashing

 
 

bug #16313: Kawa repl in Windows keeps crashing

Submitted by:  None
Submitted on:  Sun 09 Apr 2006 08:49:50 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Run-time exceptionStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 09 Feb 2007 07:34:46 AM UTC, comment #8:

Hm. Your patch doesn't seem right: The increment of delta is supposed to handle the case when textValueChanged is called when typing characters, and doing do in a "previous" line - i.e. before the outputMark. In that case if we insert or remove character in a previous line, we need to adjust the outputMark.

On the other hand, spending a lot of time in these classes is probably not worthwhile. Using a TextArea is inherently not good. Better might be to use the Swing classes, such as as the Scheme Interaction Window of JEmacs. Unfortunately, that also needs work.

I also have working a "command-line in a web browser", using AJAX techniques. That works nice, but it isn't realy for general use yet.

So if your patch works for you, that's great, and hopefully we'll get something better soon.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Mon 05 Feb 2007 12:02:00 AM UTC, comment #7:

OK, first I have verified that getText does not return CRLF on Windows. Here's sample output with byte arrays output:

getText yields: 35 124 107 97 119 97 58 49 124 35 32 40 100 101 102 105 110 101 32 102 111 111 32 34 102 111 111 34 41
getText yields: 35 124 107 97 119 97 58 49 124 35 32 40 100 101 102 105 110 101 32 102 111 111 32 34 102 111 111 34 41 10 35 124 107 97 119 97 58 50 124 35 32 102 111 111
getText yields: 35 124 107 97 119 97 58 49 124 35 32 40 100 101 102 105 110 101 32 102 111 111 32 34 102 111 111 34 41 10 35 124 107 97 119 97 58 50 124 35 32 102 111 111 10 102 111 111 10 35 124 107 97 119 97 58 51 124 35 32 102 111 111

After some additional work I found a major piece of progress which seems to help. It seems like where you had

if (pos < outputMark)
outputMark += delta;

in the text event listener it was being called at the wrong times, because outputMark never seemed to have proper values after this part ran. If I change it to this:

if (pos < outputMark)
outputMark = pos;

I get things to work mostly correct. The only problem then is that the line headers are replicated if I backtrack and re-enter a previous line. Example:

#|kawa:1|# (define foo "Foo")
#|kawa:2|# foo
Foo
#|kawa:3|# foo
Foo
#|kawa:4|# #|kawa:3|# foo
Foo

On the last entry line, I moved the cursor back to line #|kawa:3|# and hit Enter. It seems to work no matter where on the line I put the cursor. So I hope this both works for you, and helps you to clear up this last issue.

Bradley Momberger <airhadoken>
Fri 02 Feb 2007 08:07:30 AM UTC, comment #6:

Could you try to debug what is going on?

The outputMark is supposed to be the end of the output, before the user typed anything on the current line. The normal case should be the 'pos >= outputMark' case, when you just type in last line, and only hit enter when the cursor is in that last line. The other 'else' case is if the cursor is on one of the previous lines when you hit enter.

It may be useful to verify whether the string returned by getText() contains CRs (in addtions to LFs) on Windows.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Fri 02 Feb 2007 04:27:02 AM UTC, comment #5:

I can see why Ant is a better way to compile under Windows. I tried starting with configure & make and it took me almost 4 hours total to get everything to compile.

Unfortunately, I still got this with the latest version from SVN:

#|kawa:1|# (define foo :: <string> "Foo")
#|kawa:2|# (define bar :: <string> "Bar")
#|kawa:3|# foo
Foo
#|kawa:4|# bar#|kawa:4|# bar
Bar
#|kawa:5|# #!void#|kawa:5|# #!void
#|kawa:6|# (define baz :: <string> "Baz")#|kawa:6|# (define baz :: <string> "Baz")
#|kawa:7|#

The line is still being repeated on text entry after something is output the first time.

Bradley Momberger <airhadoken>
Thu 01 Feb 2007 06:53:19 AM UTC, comment #4:

I'm not sure why you got into the pos < outputMark case.
However, there does seem to be some off-by-one problems.
I checked in various changes to MessageArea.java;
could you please try them?

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 01 Feb 2007 03:30:44 AM UTC, comment #3:

Original text:
#|kawa:1|# (define foo :: <string> "foo")
#|kawa:2|# (define bar :: <string> "bar")
#|kawa:3|# bar
bar
#|kawa:4|# foo

Console output:
C:\Documents and Settings\Brad\Desktop>java -jar kawa-1.9.1.jar -w
lineBefore: 0
lineAfter: 41
Str: #|kawa:1|# (define foo :: <string> "foo")
lineBefore: 42
lineAfter: 83
Str: #|kawa:1|# (define foo :: <string> "foo")
#|kawa:2|# (define bar :: <string> "bar")
lineBefore: 84
lineAfter: 98
Str: #|kawa:1|# (define foo :: <string> "foo")
#|kawa:2|# (define bar :: <string> "bar")
#|kawa:3|# bar
lineBefore: 103
lineAfter: 117
Str: #|kawa:1|# (define foo :: <string> "foo")
#|kawa:2|# (define bar :: <string> "bar")
#|kawa:3|# bar
bar
#|kawa:4|# foo
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: 118
at java.lang.String.substring(Unknown Source)
at kawa.MessageArea.enter(MessageArea.java:73)
at kawa.MessageArea.keyPressed(MessageArea.java:88)
at java.awt.Component.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.TextComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)

at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

And finally, a scratch eval from XEmacs:

(length (append "#|kawa:1|# (define foo :: <string> \"foo\")
#|kawa:2|# (define bar :: <string> \"bar\")
#|kawa:3|# bar
bar
#|kawa:4|# foo"))
; -> 117

It seems like what is happening is that the wrong line is being found in this function. Watch what happens when i do str = str + '\n'; before the substring call.

#|kawa:17|# (car#|kawa:17|# (car
#|(---:18|# (string->list#|(---:18|# (string->list
#|(---:19|# foo#|(---:19|# foo
#|(---:20|# )#|(---:20|# )
#|(---:21|# )#|(---:21|# )
f
#|kawa:22|#

The whole line is repeated into the buffer every time i enter text.

Bradley Momberger <airhadoken>
Wed 31 Jan 2007 08:30:22 AM UTC, comment #2:

Can you try to debug it? As a start insert:
System.err.println("pos:"+pos+" lineBefore:"+lineBefore+" lineAfter:"+lineAfter+" str.len:"+str.length());
just before the failing substring operation.
Perhaps also:
System.err.println("str: ["+str+"]");

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 27 Apr 2006 05:08:38 AM UTC, comment #1:

Well, I didn't get a crash. I tried JDK 1.5.0 and gcj 4.1, both on Fedora Core 5. It may be a problem specific to Windows, or a problem with a specific JRE that you're using.
What "java" are you using?

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Sun 09 Apr 2006 08:49:50 PM UTC, original submission:

After:
#|kawa:1|# (set! p (make <java.awt.Point> 3 4))
#|kawa:2|# (set! (slot-ref p 'y) 7)
#|kawa:3|# p
java.awt.Point[x=3,y=7]
#|kawa:4|#

Almost anything at the last prompt causes a crash:
(Many related sequences, after accessing java, cause the crash)

C:\Prog\Kawa>set classpath=.\kawa-1.8.jar

C:\Prog\Kawa>java kawa.repl -w
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: 134
at java.lang.String.substring(Unknown Source)
at kawa.MessageArea.enter(MessageArea.java:69)
at kawa.MessageArea.keyPressed(MessageArea.java:84)
at java.awt.Component.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.TextComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)

at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Sour
ce)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Sour
ce)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by airhadoken (Posted a comment)
  • -unavailable- added by bothner (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 01 Feb 2007 06:53:19 AM UTCbothnerStatusWorks For Me=>Fixed
    Thu 27 Apr 2006 05:08:38 AM UTCbothnerStatusNone=>Works For Me
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup