Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 06-05-2008
fanson fanson is offline
Registered User
 
Name: Haiyang
Organization: kongzhong Corp. China
Project: storage system
 
Join Date: Aug 2007
Posts: 37
problems with python and AMI

i write an AMI method in slice file. then i need a python client. so i do all this according to the manual, chapter 29.3.

interface Work{
["AMI"] int write(...);
}

there is a 'proxy' in the main program, and i need this proxy in my ice_responce method in class AMI_Work_writeI. (further more, i use 'sleep' in 'main' for the latency of response)

then the problem occurs, the prx->xyz(...) in my ice_response() can not work correctly. but i can see that the method xyz() is invoked, but a 'print' method after this line can not work. whether the control of the program return to 'main' when the prx->xyz(...) is invoked in ice_response()? maybe something have to do with threading?

Code:
_worker_prx = None

class AMI_Work_writeI(object):
    def __init__(self, ...):
         ...

    def ice_response(self, ...):
         global _worker_prx
         r = _worker_prx->xyz(...) // this line invoke xyz() in the server,i can see it in the server's log
         print r // i can not see the output
         ...

    def ice_exception(self,...):
         ...


__main__
    global _worker_prx
    properties = Ice.createProperties()
    properties.load(config_file)
    init_data = Ice.InitializationData()
    init_data.properties = properties
    worker = properties.getProperty("workerAddress")
    base = _communicator.stringToProxy(worker)
    _worker_prx = ...

    _worker_prx->f(...)
    cb = AMI_Worker_writeI(...)
    _worker_prx->write_async(cb,...)
    ...
    import time
    time.sleep(10)
    ...
Reply With Quote
  #2 (permalink)  
Old 06-05-2008
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 962
Hi,

The most likely reason for the hang is that your client-side thread pool does not have enough threads. As discussed in this FAQ, the client thread pool is responsible for dispatching replies (including calls to AMI callbacks) and has a default maximum size of one thread.

In your example, the AMI callback is making a nested twoway invocation. This will cause a hang when there is only one thread in the client thread pool: the nested twoway invocation blocks the calling thread, therefore no threads are available to dispatch the response to the nested invocation.

Increasing the size of the client thread pool should resolve the problem. The FAQ I mentioned earlier describes the relevant properties.

Take care,
Mark
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
AMI or not AMI depending on slice args? stepancheg Help Center 2 02-26-2008 03:00 PM
AMI and timeout fanson Help Center 7 01-10-2008 04:16 AM
abut ami rellik78 Help Center 3 11-17-2006 12:27 AM
Help : AMI mykael Help Center 7 06-22-2006 12:23 PM
AMI question stephan Help Center 7 03-02-2005 04:59 AM


All times are GMT -4. The time now is 04:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.