TT#63253 SqlProcessor: Fix reader hang when processors fail on init

The reader thread waited forever for a RUNNING consumer, missing
processor threads that failed during init and flipped to ERROR. Also
join processor threads that exited but were not yet joinable.

Change-Id: I94a83a366e7ac93192258924af8a2528b8a4b1fd
(cherry picked from commit fa672748b9)
mr26.0
Rene Krenn 1 week ago
parent 37e3b3ef3c
commit 2685d47655

@ -1254,6 +1254,10 @@ sub process_table {
delete $processors{$processor->tid()};
#tablethreadingdebug('processor thread ' . ($i + 1) . ' of ' . $tableprocessing_threads . ' joinded',getlogger(__PACKAGE__));
tablethreadingdebug('processor thread tid ' . $processor->tid() . ' joined',getlogger(__PACKAGE__));
} elsif (defined $processor and not $processor->is_running()) {
eval { $processor->join(); };
delete $processors{$processor->tid()};
tablethreadingdebug('processor thread tid ' . $processor->tid() . ' joined after exit',getlogger(__PACKAGE__));
}
#} else {
# tablethreadingdebug('processor thread ' . ($i + 1) . ' of ' . $tableprocessing_threads . ' NOT joinded',getlogger(__PACKAGE__));
@ -1483,6 +1487,8 @@ sub _reader {
$reader_db->db_get_begin($context->{selectstatement},@{$context->{values_ref}}) if $reader_db->rowblock_transactional; #$context->{tablename}
tablethreadingdebug('[' . $tid . '] reader thread waiting for consumer threads',getlogger(__PACKAGE__));
while ((_get_other_threads_state($context->{errorstates},$tid) & $RUNNING) == 0) { #wait on cosumers to come up
my $other = _get_other_threads_state($context->{errorstates},$tid);
last if ($other & $ERROR) or ($other & $STOP);
#yield();
sleep($thread_sleep_secs);
}

Loading…
Cancel
Save