473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Child process hangs at pickle.dump??

Hello,

due to a memory leak (bug, I guess) in pyraf(or rather in IRAF) I have to fork an iterative process that goes through hundreds of image frames and does unspeakable things to them. In the child process, this returns a dictionary of image information for each image and is supposed to send it to the parent through pickle.dump. However, the child process hangs at pickle.dump and nothing happens. No error messages. The dictionary that is supposed to be dumped in the pipe is rather large, with possibly thousands of entires (about 2000-4000 is normal).

Is there some size limit on what you can dump in the pipe and in that case how do I increase it? I know nearly nothing about pipes and forks, so I'd be happy if you help.

Here's the code. Though you can't run it without rest of the functions maybe you'll see something horribly wrong with my forking?? The line "Finished dumping" never gets printed, it just hangs at "Dumping". I first thought the child is somehow unaware of the parent's import of pickle, so that's why I import it again, but that doesn't make a difference. Oh, and I do a os.execv("/bin/true",["true"]) at the end of the child because when IRAF closes in the child it apparently kills the child prematurely so then the code crashes cause there's no child. But just ignore IRAF/pyraf, just please tell me if there's some reason dump would hang in the child the way this is written.

thanks in advance.


Expand|Select|Wrap|Line Numbers
  1. imagedict={}
  2.  
  3. for im in infodict:
  4.     Receive,Send =os.pipe()
  5.     pid = os.fork()
  6.     if pid !=0:  
  7.         # parent
  8.         os.close(Send)
  9.         Receive = os.fdopen(Receive) 
  10.         os.waitpid(pid, 0) 
  11.         imagedict[im]=pickle.load(Receive)          else:
  12.         # child
  13.         os.close(Receive)
  14.         Send=os.fdopen(Send,'w') 
  15.         import pickle
  16.         tmpdict=veryLargeProcedure(im)
  17.         print "Dumping"
  18.         pickle.dump(tmpdict,Send)
  19.         print "finished dumping"
  20.         Send.close()
  21.         os.execv("/bin/true",["true"])
Jan 16 '08 #1
0 1763

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michael Hohn | last post by:
Hi, under python 2.2, the pickle/unpickle sequence incorrectly restores a larger data structure I have. Under Python 2.3, these structures now give an explicit exception from...
4
by: Shi Mu | last post by:
I got a sample code and tested it but really can not understand the use of pickle and dump: >>> import pickle >>> f = open("try.txt", "w") >>> pickle.dump(3.14, f) >>> pickle.dump(, f) >>>...
16
by: John Salerno | last post by:
Here's what I have: import pickle data = open(r'C:\pickle_data.txt', 'w') image = open(r'C:\peakhell.jpg') pickle.Pickler(data) data.dump(image) data.close() image.close()
2
by: Boris Borcic | last post by:
Assuming that the items of my_stream share no content (they are dumps of db cursor fetches), is there a simple way to do the equivalent of def pickles(my_stream) : from cPickle import...
6
by: Jim Lewis | last post by:
Pickling an instance of a class, gives "can't pickle instancemethod objects". What does this mean? How do I find the class method creating the problem?
3
by: fizilla | last post by:
Hello all! I have the following weird problem and since I am new to Python I somehow cannot figure out an elegant solution. The problem reduces to the following question: How to pickle a...
1
by: Nagu | last post by:
I didn't have the problem with dumping as a string. When I tried to save this object to a file, memory error pops up. I am sorry for the mention of size for a dictionary. What I meant by...
0
by: Gabriel Genellina | last post by:
En Thu, 17 Jul 2008 09:40:29 -0300, <DWebre@dotd.la.govescribi�: The example doesn't have any readline(). Make sure you open the file in binary format ('wb' or 'rb'). If you have a list of...
1
by: IceMan85 | last post by:
Hi to all, I have spent the whole morning trying, with no success to pickle an object that I have created. The error that I get is : Can't pickle 'SRE_Match' object: <_sre.SRE_Match object at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.