Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Deadlock when rewriting resources #840

Closed

Description

@GoogleCodeExporter
Sometimes under high load I can see rewrites being stuck for 10 seconds. gdb 
gives this backtrace:

#0  pthread_cond_timedwait () at 
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x0000000000aabc36 in net_instaweb::PthreadCondvar::TimedWait 
(this=0x11456e0, timeout_ms=0) at pagespeed/kernel/thread/pthread_condvar.cc:66
#2  0x000000000066dabe in 
net_instaweb::CheckingThreadSystem::CheckingCondvar::TimedWait (this=0x1145730, 
timeout_ms=10000)
    at pagespeed/kernel/base/checking_thread_system.cc:55
#3  0x0000000000695d64 in net_instaweb::Scheduler::AwaitWakeupUntilUs 
(this=0x11455d0, wakeup_time_us=1385368997267462)
    at pagespeed/kernel/thread/scheduler.cc:382
#4  0x0000000000695e51 in net_instaweb::Scheduler::ProcessAlarms 
(this=0x11455d0, timeout_us=10000000) at 
pagespeed/kernel/thread/scheduler.cc:401
#5  0x0000000000696034 in net_instaweb::SchedulerBlockingFunction::Block 
(this=0x7ffff0b69dd0) at pagespeed/kernel/thread/scheduler.cc:434
#6  0x0000000000540226 in net_instaweb::RewriteDriver::FinishParse 
(this=0x13e66e0) at net/instaweb/rewriter/rewrite_driver.cc:2470

It seems that sometimes Wakeup() can be called before AwaitWakeupUntilUs starts 
waiting on condition variable and thus misses condition variable broadcast and 
stucks waiting for 10 second timeout given at 
SchedulerBlockingFunction::Block().

If I lock mutex in Scheduler::Wakeup before broadcasting on condition variable 
then I can no longer see timeouts, everything works fine.

I'm using custom reverse proxy with PSOL 1.5.28.2. Looking at code I believe 
that issue is still present in trunk.

Original issue reported on code.google.com by mikear...@gmail.com on 25 Nov 2013 at 9:03

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions