Quantcast

[GHC] #5527: mkTopLevEnv: not interpreted

classic Classic list List threaded Threaded
11 messages Options
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GHC] #5527: mkTopLevEnv: not interpreted

GHC
#5527: mkTopLevEnv: not interpreted
---------------------------------+------------------------------------------
    Reporter:  cdsmith           |       Owner:              
        Type:  bug               |      Status:  new        
    Priority:  normal            |   Component:  GHC API    
     Version:  7.3               |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 When attempting to compile, load, and use a module several times per
 second with the GHC API, the compiler sometimes reports an error
 "mkTopLevEnv: not interpreted" for the module being loaded, even when that
 module isn't supposed to be interpreted.

 The attached file exhibits the bug when runs multiple times in quick
 succession (less than a second apart).  The important ingredients are:

 1. The same file is being compiled each time.
 2. The .hi and .o files still exist from the previous compile.
 3. The compiles are happening less than a second apart.

 There's some suspicion that this is a problem with timestamp resolution.

 This happens at least as far back as 7.1, and has been confirmed in the
 latest i386-linux development snapshot (7.3, from Sep 6, 2011).  The
 attached code is for 7.3, but analogous code for older versions shows the
 same bug.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |       Owner:              
        Type:  bug      |      Status:  new        
    Priority:  normal   |   Component:  GHC API    
     Version:  7.3      |    Keywords:              
    Testcase:           |   Blockedby:              
          Os:  Linux    |    Blocking:              
Architecture:  x86      |     Failure:  None/Unknown
------------------------+---------------------------------------------------
Changes (by cdsmith):

  * os:  Unknown/Multiple => Linux
  * architecture:  Unknown/Multiple => x86


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |        Owner:              
        Type:  bug      |       Status:  new        
    Priority:  normal   |    Milestone:              
   Component:  GHC API  |      Version:  7.3        
    Keywords:           |     Testcase:              
   Blockedby:           |   Difficulty:              
          Os:  Linux    |     Blocking:              
Architecture:  x86      |      Failure:  None/Unknown
------------------------+---------------------------------------------------

Comment(by simonpj):

 See this thread for more details: http://www.haskell.org/pipermail
 /glasgow-haskell-users/2011-October/020975.html, including various
 situations in which the bug does or does not manifest itself.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |        Owner:              
        Type:  bug      |       Status:  new        
    Priority:  normal   |    Milestone:              
   Component:  GHC API  |      Version:  7.3        
    Keywords:           |     Testcase:              
   Blockedby:           |   Difficulty:              
          Os:  Linux    |     Blocking:              
Architecture:  x86      |      Failure:  None/Unknown
------------------------+---------------------------------------------------

Comment(by simonmar):

 Plan:

  * In this particular use case, it is better use use "*A.hs" instead of
 "A.hs" for the target, as this tells GHC that you want the module to be
 interpreted so that you can have its entire top-level scope available for
 interactive evaluation.

  * We should make `GHC.setContext` emit a proper exception in this case,
 instead of the cryptic `mkTopLevEnv` error.

  * There are strange things afoot with `-fobject-code` too: #5534

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |        Owner:              
        Type:  bug      |       Status:  new        
    Priority:  normal   |    Milestone:              
   Component:  GHC API  |      Version:  7.3        
    Keywords:           |     Testcase:              
   Blockedby:           |   Difficulty:              
          Os:  Linux    |     Blocking:              
Architecture:  x86      |      Failure:  None/Unknown
------------------------+---------------------------------------------------

Comment(by simonmar):

 One more thing: there's a comment about the behaviour when the timestamps
 of the `.o` and `.hs` file match, in [source:compiler/main/GhcMake.hs] in
 the function `checkStability`.  I'll add a pointer to this ticket from the
 comment.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |        Owner:              
        Type:  bug      |       Status:  new        
    Priority:  normal   |    Milestone:  7.6.1      
   Component:  GHC API  |      Version:  7.3        
    Keywords:           |     Testcase:              
   Blockedby:           |   Difficulty:              
          Os:  Linux    |     Blocking:              
Architecture:  x86      |      Failure:  None/Unknown
------------------------+---------------------------------------------------
Changes (by igloo):

  * milestone:  => 7.6.1


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |       Owner:  pcapriotti  
        Type:  bug      |      Status:  new        
    Priority:  normal   |   Milestone:  7.6.1      
   Component:  GHC API  |     Version:  7.3        
    Keywords:           |          Os:  Linux      
Architecture:  x86      |     Failure:  None/Unknown
  Difficulty:  Unknown  |    Testcase:              
   Blockedby:           |    Blocking:              
     Related:           |  
------------------------+---------------------------------------------------
Changes (by pcapriotti):

  * owner:  => pcapriotti
  * difficulty:  => Unknown


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |       Owner:  pcapriotti  
        Type:  bug      |      Status:  patch      
    Priority:  normal   |   Milestone:  7.6.1      
   Component:  GHC API  |     Version:  7.3        
    Keywords:           |          Os:  Linux      
Architecture:  x86      |     Failure:  None/Unknown
  Difficulty:  Unknown  |    Testcase:              
   Blockedby:           |    Blocking:              
     Related:           |  
------------------------+---------------------------------------------------
Changes (by pcapriotti):

  * status:  new => patch


Comment:

 If I understand correctly, the actual error here is in user code
 (`setContext` should be called with an `IIDecl` instead of an `IIModule`),
 and the timestamp-related issue is gone (the example now fails
 consistently).

 The only remaining problem is the cryptic error message, which should be
 improved by the attached patch.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |       Owner:  pcapriotti  
        Type:  bug      |      Status:  patch      
    Priority:  normal   |   Milestone:  7.6.1      
   Component:  GHC API  |     Version:  7.3        
    Keywords:           |          Os:  Linux      
Architecture:  x86      |     Failure:  None/Unknown
  Difficulty:  Unknown  |    Testcase:              
   Blockedby:           |    Blocking:              
     Related:           |  
------------------------+---------------------------------------------------

Comment(by simonmar):

 pcapriotti: your patch looks ok to me, go ahead.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
------------------------+---------------------------------------------------
    Reporter:  cdsmith  |       Owner:  pcapriotti  
        Type:  bug      |      Status:  patch      
    Priority:  normal   |   Milestone:  7.6.1      
   Component:  GHC API  |     Version:  7.3        
    Keywords:           |          Os:  Linux      
Architecture:  x86      |     Failure:  None/Unknown
  Difficulty:  Unknown  |    Testcase:              
   Blockedby:           |    Blocking:              
     Related:           |  
------------------------+---------------------------------------------------

Comment(by p.capriotti@…):

 commit b8e0074794e085fdc2271f39aec92a0b472c6b46
 {{{
 Author: Paolo Capriotti <[hidden email]>
 Date:   Wed Jun 6 15:24:21 2012 +0100

     Better error messages for setContext (#5527).

     Make InteractiveEval.setContext throw a clearer exception when it is
     asked to add an IIModule which is not a home module or is not
     interpreted.

  compiler/main/InteractiveEval.hs |   35
 +++++++++++++++++++++++------------
  1 files changed, 23 insertions(+), 12 deletions(-)
 }}}

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5527: mkTopLevEnv: not interpreted

GHC
In reply to this post by GHC
#5527: mkTopLevEnv: not interpreted
---------------------------+------------------------------------------------
  Reporter:  cdsmith       |          Owner:  pcapriotti
      Type:  bug           |         Status:  closed    
  Priority:  normal        |      Milestone:  7.6.1    
 Component:  GHC API       |        Version:  7.3      
Resolution:  fixed         |       Keywords:            
        Os:  Linux         |   Architecture:  x86      
   Failure:  None/Unknown  |     Difficulty:  Unknown  
  Testcase:                |      Blockedby:            
  Blocking:                |        Related:            
---------------------------+------------------------------------------------
Changes (by pcapriotti):

  * status:  patch => closed
  * resolution:  => fixed


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5527#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Loading...