BitOne / php-meminfo

PHP extension to get insight about memory usage
MIT License
1.08k stars 78 forks source link

segfault using it with swoole #117

Open apinstein opened 3 years ago

apinstein commented 3 years ago

I was excited to try this to debug a long-lived script I am running with swoole.

However, about 50%+ of the time I run meminfo_dump() it segfaults.

Anything I can do to help you debug this?

I'm not sure how to capture the crash log...

apinstein commented 3 years ago

I tried a swoole mutex and that prevents the segfault but the dump is corrupted json about 50% of the time...

 57       $lock = new \Swoole\Lock(SWOOLE_MUTEX);
 58       $lock->lock();
 59       meminfo_dump(fopen("/tmp/book-memory-{$i}.json", 'w'));
 60       \Swoole\Coroutine\System::sleep(10);
 61       $lock->unlock();
 62       unset($lock);