Skip to content

Commit 3318dcc

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: php-fpm: fix Solaris port events.mechanism
2 parents f513987 + 6ccbaa1 commit 3318dcc

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ PHP NEWS
5252
. Enable process renaming on macOS. (devnexen)
5353
. Added pm.max_spawn_rate option to configure max spawn child processes rate.
5454
(Paulius Sapragonas)
55+
. Fixed bug #65800 (Events port mechanism). (psumbera)
5556

5657
- FTP:
5758
. Convert resource<ftp> to object \FTP\Connection. (Sara)

sapi/fpm/fpm/events/port.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ static int fpm_event_port_clean() /* {{{ */
112112
*/
113113
static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long int timeout) /* {{{ */
114114
{
115-
int ret, i, nget;
115+
int ret
116+
unsigned int i, nget;
116117
timespec_t t;
117118

118119
/* convert timeout into timespec_t */
@@ -121,13 +122,25 @@ static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long in
121122

122123
/* wait for incoming event or timeout. We want at least one event or timeout */
123124
nget = 1;
125+
events[0].portev_user = (void *)-1; /* so we can double check that an event was returned */
126+
124127
ret = port_getn(pfd, events, nevents, &nget, &t);
125128
if (ret < 0) {
126129

127130
/* trigger error unless signal interrupt or timeout */
128131
if (errno != EINTR && errno != ETIME) {
129132
zlog(ZLOG_WARNING, "poll() returns %d", errno);
130133
return -1;
134+
} else if (nget > 0 && events[0].portev_user == (void *)-1) {
135+
/* This confusing API can return an event at the same time
136+
* that it reports EINTR or ETIME. If that occurs, just
137+
* report the event. With EINTR, nget can be > 0 without
138+
* any event, so check that portev_user was filled in.
139+
*
140+
* See discussion thread
141+
* http://marc.info/?l=opensolaris-networking-discuss&m=125071205204540
142+
*/
143+
nget = 0;
131144
}
132145
}
133146

0 commit comments

Comments
 (0)