bugKawa - Bugs: bug #11862, can't open file input ports except...

 
 

bug #11862: can't open file input ports except on Kawa main thread

Submitter:  Steve Yegge <stevey>
Submitted:  Sat 05 Feb 2005 04:46:13 PM UTC
   
 
Category:  Scheme library Severity:  3 - Normal
Item Group:  Run-time exception Status:  Works For Me
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 17 Mar 2005 11:24:45 PM UTC, comment #1: 

Seems to be working now.

Per Bothner <bothner>
Group administrator
Sat 05 Feb 2005 04:46:13 PM UTC, original submission:  

I've found that I can't read data from files using Scheme input ports on any thread other than Kawa's main interpreter thread.  This causes problems for me in Swing applications, since Swing events happen on a separate dedicated thread.

This use case demonstrates the problem:

(invoke
 (make <java.lang.Thread>
   (object (<java.lang.Runnable>)
   ((run) :: <void>
    (let ((p (open-input-file "very-small-test.scm")))
      (let f ((x (read-line p)))
(if (eof-object? x)
    (begin
      (close-input-port p)
      '())
    (cons x (f (read-line p)))))))))
 'start)
java.lang.NullPointerException
at gnu.mapping.InPort.openFile(InPort.java:97)
at gnu.mapping.InPort.openFile(InPort.java:91)
at kawa.lib.ports.openInputFile(ports.scm:2)
at atInteractiveLevel$275$object.run(<stdin>:1844)
at java.lang.Thread.run(Thread.java:534)

If you run the let-expression without wrapping in a thread, it works fine.

It's hard to tell from the stack trace, but some poking around showed that CallContext.getInstance() or CallContext.getInstance.getEnvironment() was null, can't remember which anymore. 

This problem only appears to happen in 1.7.91, not in 1.7, and it happens using Sun JDK 1.4.2 and also 1.5.0 (on Linux and Cygwin/XP).

Steve Yegge <stevey>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-03-17 bothner StatusNone Works For Me
    Assigned toNone bothner
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code