Python Forum
Python Interpreter: trouble with memory mapped .nfs0000x files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Interpreter: trouble with memory mapped .nfs0000x files
#1
Hi everybody!
I have been stuck troubleshooting this situation all day and was hoping that somebody here could help me.

I am writing an extension module and want to load it directly from IPython.

When I rebuild the file, the old one is not deleted.
Instead, NFS turns it into one of these awful .nfs00000000fc4c982d001150ce files.

After rebuilding the .so, I try to import my package. I get the old .so (.nfs0000) instead of my updates (mypkg.so).

So far, the only fix I can find is to kill the IPython kernel and boot it back up again. Unfortunately, in my environment, this is unacceptable.

I am looking for a way to inform IPython that it can safely let go of this memory mapped file without having to restart the whole interpreter. Then, NFS can release the temporary hidden file and I can get back to business.

I have been trying to fix this for hours, but can't find anything that works.
Does anybody know how to do this without killing the IPython kernel? I am looking for something like munmap in unix/C, but have not been able find anything for Python.

Thanks!!

-tk






 >>>import mypkg

 >>>import psutil ; p = psutil.Process()

 >>>[x for x in p.memory_maps(grouped=False) if "mypkg" in x.path]
Out[3]: 
[pmmap_ext(addr='7f4fe608d000-7f4fe60b7000', perms='r-xp', path='/path/to/mypkg/mypkg.so', rss=172032, size=172032, pss=172032, shared_clean=0, shared_dirty=0, private_clean=172032, private_dirty=0, referenced=172032, anonymous=0, swap=0),
 pmmap_ext(addr='7f4fe60b7000-7f4fe62b6000', perms='---p', path='/path/to/mypkg/mypkg.so', rss=0, size=2093056, pss=0, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=0, referenced=0, anonymous=0, swap=0),
 pmmap_ext(addr='7f4fe62b6000-7f4fe62b7000', perms='r--p', path='/path/to/mypkg/mypkg.so', rss=4096, size=4096, pss=4096, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=4096, referenced=4096, anonymous=4096, swap=0),
 pmmap_ext(addr='7f4fe62b7000-7f4fe62b9000', perms='rw-p', path='/path/to/mypkg/mypkg.so', rss=8192, size=8192, pss=8192, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=8192, referenced=8192, anonymous=8192, swap=0)]

***rebuild .so here***


 >>>[x for x in p.memory_maps(grouped=False) if "mypkg" in x.path]
Out[4]: 
[pmmap_ext(addr='7f4fe608d000-7f4fe60b7000', perms='r-xp', path='/path/to/mypkg/.nfs00000000fc4c982d001150ce', rss=172032, size=172032, pss=172032, shared_clean=0, shared_dirty=0, private_clean=172032, private_dirty=0, referenced=172032, anonymous=0, swap=0),
 pmmap_ext(addr='7f4fe60b7000-7f4fe62b6000', perms='---p', path='/path/to/mypkg/.nfs00000000fc4c982d001150ce', rss=0, size=2093056, pss=0, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=0, referenced=0, anonymous=0, swap=0),
 pmmap_ext(addr='7f4fe62b6000-7f4fe62b7000', perms='r--p', path='/path/to/mypkg/.nfs00000000fc4c982d001150ce', rss=4096, size=4096, pss=4096, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=4096, referenced=4096, anonymous=4096, swap=0),
 pmmap_ext(addr='7f4fe62b7000-7f4fe62b9000', perms='rw-p', path='/path/to/mypkg/.nfs00000000fc4c982d001150ce', rss=8192, size=8192, pss=8192, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=8192, referenced=8192, anonymous=8192, swap=0)]
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020