SlideShare a Scribd company logo
1 of 14
Download to read offline
How to inspect
RUNNING perl process
@hirose31
ひろせ まさあき
YAPC::Asia Tokyo 2013
LT Day 1
Who am I
•PAUSE ID: HIROSE / @hirose31
•Recognize as NON-human on CPAN
テキスト
https://metacpan.org/module/Acme::CPANAuthors::Nonhuman
Agenda
How to inspect a RUNNING perl process
•Motivation
•Revisit existing ideas
•Introduce a my idea
Motivation
•WHY: shooting trouble of RUNNING perl
process
•examine where perl process is running
•where does process hang up?
•where does process loop forever?
•which pacage leaks memory?
•want to examine from OUTER without
editing target process/script
Revisit existing ideas
‘strace’
• strace -fF -Tttt -s 512 -p PID
• current system call
• show the time spent in system calls
• peep into an ASCII string
• no requires☺, just attach process
• show just name of system call not perl symbol☹
1379392067.757575 accept(5,
1379392038.406593 write(5, "220003 select
sleep(8) ", 22) = 22 <0.000083>
1379392038.406791 read(5,
Revisit existing ideas
‘gdb’
• Attach and trace code by gdb
• Generate a core file by gcore PID
• “Introduction gdb to perl programmers”, @stanaka,
Shibuya.pm #9
http://blog.stanaka.org/entry/20080630/1214780557
• show stacktrace with perl symbol
#0 0x00007fb086990c20 in __accept_nocancel () from /lib/
libpthread.so.0
#1 0x00000000004f19e8 in Perl_pp_accept (my_perl=0xd69010) at
pp_sys.c:2554
...
#5 0x0000000000420eef in main (argc=8, argv=0x7fff34899828,
env=0x7fff34899870) at perlmain.c:99
Revisit existing ideas
‘bulkdbg’
•https://github.com/ahiguti/bulkdbg
•bulkdbg PID
•show stackstrace with perl symbol
•convinient by batch
3183
__accept_nocancel:Perl_pp_accept:Perl_pop_scope:Perl_peep:_dl_r
tld_di_serinfo:PerlIO_debug:_dl_rtld_di_serinfo:PerlIO_debug:ca
lloc:calloc:__libc_malloc:calloc:_dl_rtld_di_serinfo:S_hv_fetch
_common
Revisit existing ideas
‘gdbperl’
• https://github.com/ahiguti/gdbperl
• examine state of perl interpreter using gdb
• “debugging Perl script with gdb”, Akira Higuchi, YAPC::Asia Tokyo
2011
http://www.slideshare.net/akirahiguchi/gdbperl
• show stacktrace with perl code☺, package name, line number!!
• depend heavily on perl version/internal structure☹
perl_backtrace:
[8] IO::Socket::accept() <- /.../perl-5.8.8-threads/lib/
site_perl/5.8.8/Starlet/Server.pm:106(Starlet::Server)
[7] (loop) <- /.../perl-5.8.8-threads/lib/site_perl/5.8.8/
Starlet/Server.pm:105(Starlet::Server)
...
[1] Plack::Runner::run() <- /.../perl-5.8.8-threads/bin/
plackup:10(main)
Introduce a my idea
‘inspect-perl-proc’
• https://github.com/hirose31/inspect-perl-proc
• Attach by gdb and run arbitrary Perl code
using Perl_eval_pv
• less requires: gdb, perl with debug symbol (-
DDEBUGGING=-g)
• not depend on perl version / perl internal
structure
• save output to file, not output STDOUT/
STDERR of target process
dump-perl-stacktrace
• dump-perl-stacktrace
= inspect-perl-proc --mode 'dump-stacktrace'
• Carp::longmess(‘Dump stacktrace’)
Dump stacktrace at /.../perl-5.8.8-threads/lib/5.8.8/x86_64-
linux-thread-multi/IO/Socket.pm line 237
IO::Socket::accept('IO::Socket::INET=GLOB()')
called at /.../Starlet/Server.pm line 106
Starlet::Server::accept_loop('Plack::Handler::
Starlet=HASH()', 'CODE()', 100) called
at /.../Starlet.pm line 67
Plack::Handler::Starlet::run('Plack::Handler::
Starlet=HASH()', 'CODE()') called
at /.../Plack/Loader.pm line 84
...
Plack::Runner::run('Plack::Runner=HASH()') called
at /.../bin/plackup line 10
dump-perl-memusage
• dump-perl-memusage
= inspect-perl-proc --mode 'dump-memusage'
• Dump memory usage with B::Size2::Terse::package_size
for each packages (Devel::Symdump)
• save as as hashref so you can filter or sort easily
{
'main' => '95589',
...
'PerlIO::scalar' => '1025',
'Plack' => '3056',
'Plack::App' => '200',
'Plack::App::URLMap' => '26681',
'Plack::Builder' => '31972',
...
};
dump-perl-inc
• dump-perl-inc
= inspect-perl-proc --mode 'dump-inc'
• Dump %INC
• list up loaded modules for preloading (CoW)
• save as as hashref so you can filter or sort easily
{
'parent.pm' => '/.../parent.pm',
'HTTP/Status.pm' => '/.../HTTP/Status.pm',
'POSIX.pm' => '/.../POSIX.pm',
'List/Util.pm' => '/.../List/Util.pm',
'Plack/Loader.pm' => '/.../Plack/Loader.pm',
'Cwd.pm' => '/.../Cwd.pm',
'Fcntl.pm' => '/.../Fcntl.pm',
...
};
Introduce a my idea
‘inspect-perl-proc’
• https://github.com/hirose31/inspect-perl-proc
• Attach by gdb and run arbitrary code using
Perl_eval_pv
• less requires: gdb, perl with debug symbol (-
DDEBUGGING=-g)
• not depend on perl version / perl internal
structure
• save output to file, not output STDOUT/
STDERR of target process
Thanks :D

More Related Content

What's hot

How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
Sean Hess
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
knight1128
 

What's hot (20)

Perl Memory Use 201209
Perl Memory Use 201209Perl Memory Use 201209
Perl Memory Use 201209
 
2016年のPerl (Long version)
2016年のPerl (Long version)2016年のPerl (Long version)
2016年のPerl (Long version)
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
 
PL/Perl - New Features in PostgreSQL 9.0
PL/Perl - New Features in PostgreSQL 9.0PL/Perl - New Features in PostgreSQL 9.0
PL/Perl - New Features in PostgreSQL 9.0
 
Shellcode Analysis - Basic and Concept
Shellcode Analysis - Basic and ConceptShellcode Analysis - Basic and Concept
Shellcode Analysis - Basic and Concept
 
"Развитие ветки PHP-7"
"Развитие ветки PHP-7""Развитие ветки PHP-7"
"Развитие ветки PHP-7"
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance Tips
 
Profiling with Devel::NYTProf
Profiling with Devel::NYTProfProfiling with Devel::NYTProf
Profiling with Devel::NYTProf
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
 
The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4
 
Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
 
台科逆向簡報
台科逆向簡報台科逆向簡報
台科逆向簡報
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
PHP 7 performances from PHP 5
PHP 7 performances from PHP 5PHP 7 performances from PHP 5
PHP 7 performances from PHP 5
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
x86
x86x86
x86
 
Php7 hhvm and co
Php7 hhvm and coPhp7 hhvm and co
Php7 hhvm and co
 

Similar to How to inspect a RUNNING perl process

これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
goccy
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
Nobuo Danjou
 
Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016
Xavier Ashe
 

Similar to How to inspect a RUNNING perl process (20)

Systems Programming Assignment Help - Processes
Systems Programming Assignment Help - ProcessesSystems Programming Assignment Help - Processes
Systems Programming Assignment Help - Processes
 
JProfiler8 @ OVIRT
JProfiler8 @ OVIRTJProfiler8 @ OVIRT
JProfiler8 @ OVIRT
 
From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
 
Lightweight static code analysis with semgrep
Lightweight static code analysis with semgrepLightweight static code analysis with semgrep
Lightweight static code analysis with semgrep
 
Taking Hunting to the Next Level: Hunting in Memory
Taking Hunting to the Next Level: Hunting in MemoryTaking Hunting to the Next Level: Hunting in Memory
Taking Hunting to the Next Level: Hunting in Memory
 
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)これからのPerlプロダクトのかたち(YAPC::Asia 2013)
これからのPerlプロダクトのかたち(YAPC::Asia 2013)
 
PHP Profiling/performance
PHP Profiling/performancePHP Profiling/performance
PHP Profiling/performance
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
 
04_ForkPipe.pptx
04_ForkPipe.pptx04_ForkPipe.pptx
04_ForkPipe.pptx
 
System Programming and Administration
System Programming and AdministrationSystem Programming and Administration
System Programming and Administration
 
Lateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your NetworkLateral Movement: How attackers quietly traverse your Network
Lateral Movement: How attackers quietly traverse your Network
 
Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016Lateral Movement - Hacker Halted 2016
Lateral Movement - Hacker Halted 2016
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 
The Art of JVM Profiling
The Art of JVM ProfilingThe Art of JVM Profiling
The Art of JVM Profiling
 
PHP & Performance
PHP & PerformancePHP & Performance
PHP & Performance
 
Preparing code for Php 7 workshop
Preparing code for Php 7 workshopPreparing code for Php 7 workshop
Preparing code for Php 7 workshop
 

More from Masaaki HIROSE (6)

JVM! JVM! JVM!
JVM! JVM! JVM!JVM! JVM! JVM!
JVM! JVM! JVM!
 
Redunduncy of NAT instance on AWS/VPC
Redunduncy of NAT instance on AWS/VPCRedunduncy of NAT instance on AWS/VPC
Redunduncy of NAT instance on AWS/VPC
 
Introduction of aws-cli
Introduction of aws-cliIntroduction of aws-cli
Introduction of aws-cli
 
『Ficia』インフラとPerlにまつわるエトセトラ
『Ficia』インフラとPerlにまつわるエトセトラ『Ficia』インフラとPerlにまつわるエトセトラ
『Ficia』インフラとPerlにまつわるエトセトラ
 
Shibuya.pm #9 My First XS
Shibuya.pm #9 My First XSShibuya.pm #9 My First XS
Shibuya.pm #9 My First XS
 
Aio
AioAio
Aio
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

How to inspect a RUNNING perl process

  • 1. How to inspect RUNNING perl process @hirose31 ひろせ まさあき YAPC::Asia Tokyo 2013 LT Day 1
  • 2. Who am I •PAUSE ID: HIROSE / @hirose31 •Recognize as NON-human on CPAN テキスト https://metacpan.org/module/Acme::CPANAuthors::Nonhuman
  • 3. Agenda How to inspect a RUNNING perl process •Motivation •Revisit existing ideas •Introduce a my idea
  • 4. Motivation •WHY: shooting trouble of RUNNING perl process •examine where perl process is running •where does process hang up? •where does process loop forever? •which pacage leaks memory? •want to examine from OUTER without editing target process/script
  • 5. Revisit existing ideas ‘strace’ • strace -fF -Tttt -s 512 -p PID • current system call • show the time spent in system calls • peep into an ASCII string • no requires☺, just attach process • show just name of system call not perl symbol☹ 1379392067.757575 accept(5, 1379392038.406593 write(5, "220003 select sleep(8) ", 22) = 22 <0.000083> 1379392038.406791 read(5,
  • 6. Revisit existing ideas ‘gdb’ • Attach and trace code by gdb • Generate a core file by gcore PID • “Introduction gdb to perl programmers”, @stanaka, Shibuya.pm #9 http://blog.stanaka.org/entry/20080630/1214780557 • show stacktrace with perl symbol #0 0x00007fb086990c20 in __accept_nocancel () from /lib/ libpthread.so.0 #1 0x00000000004f19e8 in Perl_pp_accept (my_perl=0xd69010) at pp_sys.c:2554 ... #5 0x0000000000420eef in main (argc=8, argv=0x7fff34899828, env=0x7fff34899870) at perlmain.c:99
  • 7. Revisit existing ideas ‘bulkdbg’ •https://github.com/ahiguti/bulkdbg •bulkdbg PID •show stackstrace with perl symbol •convinient by batch 3183 __accept_nocancel:Perl_pp_accept:Perl_pop_scope:Perl_peep:_dl_r tld_di_serinfo:PerlIO_debug:_dl_rtld_di_serinfo:PerlIO_debug:ca lloc:calloc:__libc_malloc:calloc:_dl_rtld_di_serinfo:S_hv_fetch _common
  • 8. Revisit existing ideas ‘gdbperl’ • https://github.com/ahiguti/gdbperl • examine state of perl interpreter using gdb • “debugging Perl script with gdb”, Akira Higuchi, YAPC::Asia Tokyo 2011 http://www.slideshare.net/akirahiguchi/gdbperl • show stacktrace with perl code☺, package name, line number!! • depend heavily on perl version/internal structure☹ perl_backtrace: [8] IO::Socket::accept() <- /.../perl-5.8.8-threads/lib/ site_perl/5.8.8/Starlet/Server.pm:106(Starlet::Server) [7] (loop) <- /.../perl-5.8.8-threads/lib/site_perl/5.8.8/ Starlet/Server.pm:105(Starlet::Server) ... [1] Plack::Runner::run() <- /.../perl-5.8.8-threads/bin/ plackup:10(main)
  • 9. Introduce a my idea ‘inspect-perl-proc’ • https://github.com/hirose31/inspect-perl-proc • Attach by gdb and run arbitrary Perl code using Perl_eval_pv • less requires: gdb, perl with debug symbol (- DDEBUGGING=-g) • not depend on perl version / perl internal structure • save output to file, not output STDOUT/ STDERR of target process
  • 10. dump-perl-stacktrace • dump-perl-stacktrace = inspect-perl-proc --mode 'dump-stacktrace' • Carp::longmess(‘Dump stacktrace’) Dump stacktrace at /.../perl-5.8.8-threads/lib/5.8.8/x86_64- linux-thread-multi/IO/Socket.pm line 237 IO::Socket::accept('IO::Socket::INET=GLOB()') called at /.../Starlet/Server.pm line 106 Starlet::Server::accept_loop('Plack::Handler:: Starlet=HASH()', 'CODE()', 100) called at /.../Starlet.pm line 67 Plack::Handler::Starlet::run('Plack::Handler:: Starlet=HASH()', 'CODE()') called at /.../Plack/Loader.pm line 84 ... Plack::Runner::run('Plack::Runner=HASH()') called at /.../bin/plackup line 10
  • 11. dump-perl-memusage • dump-perl-memusage = inspect-perl-proc --mode 'dump-memusage' • Dump memory usage with B::Size2::Terse::package_size for each packages (Devel::Symdump) • save as as hashref so you can filter or sort easily { 'main' => '95589', ... 'PerlIO::scalar' => '1025', 'Plack' => '3056', 'Plack::App' => '200', 'Plack::App::URLMap' => '26681', 'Plack::Builder' => '31972', ... };
  • 12. dump-perl-inc • dump-perl-inc = inspect-perl-proc --mode 'dump-inc' • Dump %INC • list up loaded modules for preloading (CoW) • save as as hashref so you can filter or sort easily { 'parent.pm' => '/.../parent.pm', 'HTTP/Status.pm' => '/.../HTTP/Status.pm', 'POSIX.pm' => '/.../POSIX.pm', 'List/Util.pm' => '/.../List/Util.pm', 'Plack/Loader.pm' => '/.../Plack/Loader.pm', 'Cwd.pm' => '/.../Cwd.pm', 'Fcntl.pm' => '/.../Fcntl.pm', ... };
  • 13. Introduce a my idea ‘inspect-perl-proc’ • https://github.com/hirose31/inspect-perl-proc • Attach by gdb and run arbitrary code using Perl_eval_pv • less requires: gdb, perl with debug symbol (- DDEBUGGING=-g) • not depend on perl version / perl internal structure • save output to file, not output STDOUT/ STDERR of target process