• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Hey! Where are my thread dumps?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hey! Where are my thread dumps?


  • Subject: Re: Hey! Where are my thread dumps?
  • From: Anjo Krank <email@hidden>
  • Date: Fri, 7 Aug 2009 07:53:49 +0200


Am 07.08.2009 um 07:45 schrieb Chuck Hill:

Yes, I know how to get a thread dump. There are many tools. The question is why the simple, basic kill -QUIT is not working for deployed apps on Leopard.

Works for me (wonder wotaskd, custom launchd script). Dunno if the launch script influences it.


Cheers, Anjo

s11:~ root# cat /Library/LaunchDaemons/ch.aximus.wotaskd.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd ">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>ch.aximus.wotaskd</string>
<key>Program</key>
<string>/usr/local/bin/startWOtaskd.rb</string>
<key>ProgramArguments</key>
<array>
<string>wotaskd</string>
<string>wotaskd</string>
<string>-WOPort</string>
<string>1085</string>
</array>
</dict>
</plist>


s11:~ root# cat /usr/local/bin/startWOtaskd.rb
#!/usr/bin/env ruby
# (2008-Dec-08)

$:.push("/usr/local/etc")
require 'siteconfig'

counter = 1
threshold = 6
logfile = "/Work/Logs/Apps/wotaskd.out"
program = File.basename($0)
defaultPath = "/System/Library/WebObjects/JavaApplications/wotaskd.woa/"
user = "appserver"
$pid = nil

if ARGV.size == 0
	puts "Usage: #{program} path_to_wotaskd [arguments]"
	puts "Example:\n   #{program} wotaskd -WOPort 1085"
	puts "The program will be started under user '#{user}'"
	puts "Default path: #{defaultPath}  (if path_to_wotaskd is relative)"
	puts "Logfile: #{logfile}"
	exit 1
end

wotaskd = ARGV.shift
wotaskd = defaultPath + wotaskd unless wotaskd =~ /^\//
args = ARGV.join(" ")
unless File.exist?(wotaskd)
  puts "ERROR. File not found: #{wotaskd}   (ARGS= #{args} )"
  exit 1
end
command = "sudo -u #{user} #{wotaskd} #{args}"


stdout = nil # set to "stdout" for debug output $SYSLOG = SysLogger.new("startWOtaskd", 5, stdout, "syslog")

trap("TERM") {   # TERM is the default kill signal
	if $pid != nil && $pid > 100
	  $SYSLOG.notice "SIGTERM received. Stopping wotaskd (pid=#{$pid})."
	  Process.kill("SIGTERM", $pid)
	end
	exit 0
}

while (counter <= threshold)
if ($pid = fork) == nil
outfile = File.new(logfile, "a")
outfile.puts "\nNEWRUN (Pid=#{$$} Counter=#{counter}) #{`date`}"
outfile.puts "COMMAND: #{command}"
$stdout.reopen(outfile)
$stderr.reopen(outfile)
exec(command)
else
$SYSLOG.notice "STARTING wotaskd (Pid=#{$pid} Counter=#{counter}). Logfile= #{logfile}"
Process.wait
end
counter = counter + 1
sleep 10
end


$SYSLOG.error "Restart threshold reached. Did restart wotaskd #{threshold} times, giving up."

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Hey! Where are my thread dumps?
      • From: Chuck Hill <email@hidden>
References: 
 >Hey! Where are my thread dumps? (From: Chuck Hill <email@hidden>)
 >Re: Hey! Where are my thread dumps? (From: Lachlan Deck <email@hidden>)
 >Re: Hey! Where are my thread dumps? (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Hey! Where are my thread dumps?
  • Next by Date: Re: Many to many relationship... some problem
  • Previous by thread: Re: Hey! Where are my thread dumps?
  • Next by thread: Re: Hey! Where are my thread dumps?
  • Index(es):
    • Date
    • Thread