Unix Technical Forum

Re: Patch for Win32 blocking problem

This is a discussion on Re: Patch for Win32 blocking problem within the pgsql Hackers forums, part of the PostgreSQL category; --> Teodor Sigaev <teodor@sigaev.ru> writes: > Patch solves the problem with blocking backend in pgwin32_waitforsinglesocket() > when it tries to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 06:15 AM
Tom Lane
 
Posts: n/a
Default Re: Patch for Win32 blocking problem

Teodor Sigaev <teodor@sigaev.ru> writes:
> Patch solves the problem with blocking backend in pgwin32_waitforsinglesocket()
> when it tries to send something to stat collector.


Adding the looping in pgwin32_send() seems clearly correct, since there
could be multiple processes trying to send to the collector at the same
time. I find the proposed patch in pgwin32_waitforsinglesocket to be a
pretty ugly kluge though. Are you sure it's needed given the other fix?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 06:16 AM
Teodor Sigaev
 
Posts: n/a
Default Re: Patch for Win32 blocking problem

> time. I find the proposed patch in pgwin32_waitforsinglesocket to be a
> pretty ugly kluge though. Are you sure it's needed given the other fix?


Loop in pgwin32_send() doesn't prevent from infinite sleeping in
WaitForMultipleObjectEx in pgwin32_waitforsinglesocket. I'm not a Windows guru
at all, and I'm not like that part of patch too. I can't find better solution...

May be that way (untested):

if ( isUDP && (what & FP_WRITE) )
for(; {
r = WaitForMultipleObjects(100 ms);
if ( r == WAIT_TIMEOUT ) {
r == WSASend( sero packet ); /* see comments in pgwin32_select()
*/
[ analyze result of WSASend:
* if success then return 1
* WSAEWOULDBLOCK - continue loop
* SOCKET_ERROR - return 0
]
} else
break;
}


I'm not sure that is more clean way...


--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:57 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com