Norm,

I presume the hardcoded 15 seconds you referred is here,

http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/print/libpapi-lpd/common/lpd-port.c#sock_connect
The problem it seems that it will always take almost double 15 seconds 
by the logic of lines

   171          *if* (errno <http://cvs.opensolaris.org/source/s?defs=errno> == 
ECONNREFUSED <http://cvs.opensolaris.org/source/s?defs=ECONNREFUSED> && timo 
<http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/print/libpapi-lpd/common/lpd-port.c#timo>
 <= 16) {
    172                         (*void*) sleep 
<http://cvs.opensolaris.org/source/s?defs=sleep>(timo 
<http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/print/libpapi-lpd/common/lpd-port.c#timo>);
    173                         timo 
<http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/print/libpapi-lpd/common/lpd-port.c#timo>
 *= 2;
    174                         *goto* retry 
<http://cvs.opensolaris.org/source/s?defs=retry>;
    175                 }
    176 

Since you have timo is initialized to 1, and it is double every time, so 
it goes
1, 2, 4, 8, 16 (so 1+2+4+8+15=31) and hence timeout is 31 seconds not 15 
seconds.

This can be easily reproduced by
time /usr/lib/print/lpd-port -H <valid host id> -t 15 -q pdub0407-tcp

where the pdub0407-tcp is a queue which does not exists on that valid host.

Can we make the time out configurable? I thinks the code change is simple
line 171,
   

*if* (errno <http://cvs.opensolaris.org/source/s?defs=errno> == ECONNREFUSED 
<http://cvs.opensolaris.org/source/s?defs=ECONNREFUSED> && timo 
<http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/print/libpapi-lpd/common/lpd-port.c#timo>
 <= timeout) {

Though What I went it more is to allow a time out be specified from PAPI.
I have many threads that looks like this (see pstack below). While I 
need to prevent
the gtk_main() from getting into one of this call, to be able to control 
this timeout
will be a big HELP!

-Ghee

115016: /local/gheet/Documents/ospm/pm/.libs/ospm-pm
-----------------  lwp# 1 / thread# 1  --------------------
 fced59d5 waitid   (0, 1ce5a, 8047270, 3)
 fce8cf9b waitpid  (1ce5a, 8047820, 0) + 63
 f9595b01 lpd_open (9900ee0, 71, 0, f) + 155
 f9594ef2 cache_update (9900ee0) + 2e
 f9594f8f lpd_find_jobs_info (9900ee0, 80478d8) + 27
 f95952bb papiPrinterListJobs (9900ee0, 9902700, 0, 0, 0, 80478d8) + 3f
 fee24806 papiPrinterListJobs (98fd380, 80ea258, 0, 0, 0, 8047908) + 7e
 0806d9eb ospm_papi_get_job_list (80ea258) + 6b
 0807dbd8 ospm_job_manager_refresh (80ca1a0) + 98
 0807d876 timely_refresh_job_view (80ca1a0) + 46
 fcfc10d8 g_timeout_dispatch (8178050, 807d830, 80ca1a0) + 24
 fcfbe684 g_main_dispatch (80ccbd8) + 1e0
 fcfbf785 g_main_context_dispatch (80ccbd8) + 85
 fcfbfba2 g_main_context_iterate (80ccbd8, 1, 1, 80afd58) + 3ce
 fcfc01a4 g_main_loop_run (83e9b00) + 1b8
 feb7afd2 gtk_main (feffb7dc, 133f, 80a6658, 8047b0c, 80a6658, feffb7dc) + b2
 0808c6ad main     (1, 8047b50, 8047b58) + 19d
 0806cf7a _start   (1, 8047c24, 0, 8047c51, 8047cb2, 8047cc7) + 7a
-----------------  lwp# 113 / thread# 113  --------------------
 fced59d5 waitid   (0, 1ce5c, f946e450, 3)
 fce8cf9b waitpid  (1ce5c, f946ea00, 0) + 63
 f9595b01 lpd_open (98ba758, 71, 0, f) + 155
 f9594ef2 cache_update (98ba758) + 2e
 f9594f41 lpd_find_printer_info (98ba758, 97aaee4) + 29
 f959518f papiPrinterQuery (98ba758, 8116b90, f946ef48, 0, 97aaee4) + 97
 fee2435a papiPrinterQuery (9902228, 9820dd0, f946ef48, 0, f946ef64) + ae
 0807b453 read_queue_properties (0) + 3a3
 fcfe42d4 g_thread_create_proxy (988ee38) + 118
 fced0d00 _thr_setup (fa8a1200) + 70
 fced0f60 _lwp_start (fa8a1200, 0, 0, 0, 0, 0)
-----------------  lwp# 112 / thread# 112  --------------------
 fced59d5 waitid   (0, 1ce57, fa7be8e0, 3)
 fce8cf9b waitpid  (1ce57, fa7bee90, 0) + 63
 f9595b01 lpd_open (9820020, 71, 0, f) + 155
 f9594ef2 cache_update (9820020) + 2e
 f9594f8f lpd_find_jobs_info (9820020, fa7bef48) + 27
 f95952bb papiPrinterListJobs (9820020, 98f9900, 0, 0, 0, fa7bef48) + 3f
 fee24806 papiPrinterListJobs (97b3cd8, 80ea258, 0, 0, 0, fa7bef78) + 7e
 0806d9eb ospm_papi_get_job_list (80ea258) + 6b
 0807a801 thread_get_job_list (9892190) + 21
 fcfe42d4 g_thread_create_proxy (98ba240) + 118
 fced0d00 _thr_setup (fa8a0200) + 70
 fced0f60 _lwp_start (fa8a0200, 0, 0, 0, 0, 0)
-----------------  lwp# 114 / thread# 114  --------------------
 fced59d5 waitid   (0, 1ce59, f958e8e0, 3)
 fce8cf9b waitpid  (1ce59, f958ee90, 0) + 63
 f9595b01 lpd_open (98baa18, 71, 0, f) + 155
 f9594ef2 cache_update (98baa18) + 2e
 f9594f8f lpd_find_jobs_info (98baa18, f958ef48) + 27
 f95952bb papiPrinterListJobs (98baa18, 98feeb8, 0, 0, 0, f958ef48) + 3f
 fee24806 papiPrinterListJobs (9902080, 80ea258, 0, 0, 0, f958ef78) + 7e
 0806d9eb ospm_papi_get_job_list (80ea258) + 6b
 0807a801 thread_get_job_list (97428a8) + 21
 fcfe42d4 g_thread_create_proxy (988c030) + 118
 fced0d00 _thr_setup (fa8a0a00) + 70
 fced0f60 _lwp_start (fa8a0a00, 0, 0, 0, 0, 0)






Norm Jacobs wrote:
> Not sure why you get 31 seconds.  There is a hardcoded 15 second wait in 
> psm-lpd.so when it attempts to connect to a remote print service. 
>
>     -Norm
>
> Ghee Teo wrote:
>   
>> Hi,
>>
>> I have a queue which is to access a remote print server, but the remote 
>> print server has since
>> been re-installed, the host still exits, but the print service it set up 
>> no longer exist.
>>
>> So when I call papiServiceCreate (0 on that queue, it took 31 seconds,
>>
>> ./test-queue-state pdub0407-tcp
>> getting queue state of pdub0407-tcp
>> time used in papiServiceCreate(): 0.000012
>> printer offline/Unknown
>> Queue pdub0407-tcp is at 0
>> Time elapsed = 31.052967
>>
>> While I may be doing a shorter time out on the calling side, it is not 
>> too bad with CLI, but
>> dreadful with GUI. Any way of changing this on PAPI?
>>
>> -Ghee
>>
>> _______________________________________________
>> printing-discuss mailing list
>> printing-discuss at opensolaris.org
>>   
>>     
>
> _______________________________________________
> printing-discuss mailing list
> printing-discuss at opensolaris.org
>   


Reply via email to