#10098: Flaky doctest in sage/interfaces/expect.py
-----------------------+----------------------------------------------------
   Reporter:  mpatel   |       Owner:  mvngu   
       Type:  defect   |      Status:  new     
   Priority:  blocker  |   Milestone:  sage-4.6
  Component:  doctest  |    Keywords:          
     Author:           |    Upstream:  N/A     
   Reviewer:           |      Merged:          
Work_issues:           |  
-----------------------+----------------------------------------------------

Old description:

> With #10004 merged into 4.6.alpha3, I get the doctest failures
> {{{
> #!
> sage -t -long  -force_lib devel/sage/sage/interfaces/expect.py
> **********************************************************************
> File
> "/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/devel
> /sage-main/sage/interfaces/expect.py", line 596:
>     sage: L = [t[1] for t in f(range(5))]
> Expected nothing
> Got:
>     [Errno 16] Device or resource busy:
> '/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/.sage/temp/cleo/32313/dir_0/.nfs00000000007d541a0000abe9'
> **********************************************************************
> File
> "/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/devel
> /sage-main/sage/interfaces/expect.py", line 603:
>     sage: L = [t[1] for t in f(range(5))]
> Expected nothing
> Got:
>     [Errno 16] Device or resource busy:
> '/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/.sage/temp/cleo/32313/dir_1/.nfs00000000007d541a0000abf1'
> }}}
> on the Skynet machines cleo, eno, fulvia, sextus, and taurus.

New description:

 With #10004 merged into 4.6.alpha3, I get the doctest failures
 {{{
 #!python
 sage -t -long  -force_lib devel/sage/sage/interfaces/expect.py
 **********************************************************************
 File
 "/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/devel
 /sage-main/sage/interfaces/expect.py", line 596:
     sage: L = [t[1] for t in f(range(5))]
 Expected nothing
 Got:
     [Errno 16] Device or resource busy:
 
'/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/.sage/temp/cleo/32313/dir_0/.nfs00000000007d541a0000abe9'
 **********************************************************************
 File
 "/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/devel
 /sage-main/sage/interfaces/expect.py", line 603:
     sage: L = [t[1] for t in f(range(5))]
 Expected nothing
 Got:
     [Errno 16] Device or resource busy:
 
'/home/buildbot/build/sage/cleo-1/cleo_full/build/sage-4.6.alpha3/.sage/temp/cleo/32313/dir_1/.nfs00000000007d541a0000abf1'
 }}}
 on the Skynet machines cleo, eno, fulvia, sextus, and taurus.

--

Comment(by mpatel):

 Replying to [comment:4 vbraun]:
 > Did that appear at the same time as the "sync" was removed from NFS? Or
 did we upgrade the `expect` python module?

 As far as I'm aware, the Skynet cluster is administered independently (by
 Mariah Lenox) from the Sage cluster.  I don't know whether Mariah has made
 any recent changes to Skynet's NFS configuration.

 We made some changes to `sage.interfaces.expect` at #10004.

 > I think something is tripping over the following fact: In UNIX, you can
 open a file, then delete it, then delete the containing directory. The
 file is still open for business until you close it. But NFS doesn't have
 inodes, so if you delete an open file the NFS volume will contain a fake
 directory entry `.nfs00000000007d541a0000abf1` that only disappears when
 you close the file. I guess that the  "Device or resource busy" error is
 from trying to delete the non-empty directory. Either because the open
 file descriptor was leaked or because of some concurrency issue with NFS.

 Thanks!  I've tried to make an example:
 {{{
 #!python
 sage: import os
 sage: os.mkdir('dir')
 sage: f = open('dir/foo', 'w')
 sage: os.listdir('dir')
 ['foo']
 sage: # Now 'rm dir/foo' in a separate window.
 sage: sage: os.listdir('dir')
 ['.nfs000000000143f92500013636']
 sage:  os.unlink('dir/.nfs000000000143f92500013636')
 ---------------------------------------------------------------------------
 OSError                                   Traceback (most recent call
 last)

 /home/mpatel/<ipython console> in <module>()

 OSError: [Errno 16] Device or resource busy:
 'dir/.nfs000000000143f92500013636'
 sage: os.rmdir('dir')
 ---------------------------------------------------------------------------
 OSError                                   Traceback (most recent call
 last)

 /home/mpatel/<ipython console> in <module>()

 OSError: [Errno 39] Directory not empty: 'dir'
 sage: f.close()
 sage: os.rmdir('dir')
 sage:
 }}}

 For the problem in the description, I suppose Sage tries to empty a
 temporary directory.  What if we wrap that in a `try-except` block?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10098#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to