Error Message Error Cleaning Up Agent Threads
java; java agent; troubleshooting script; Error cleaning up agent threads; threadgroup Technote (FAQ) Question There can be a number of reasons why a Java agent might return the following message on the server console: "Error cleaning up agent threads." In most cases, the Lotus Domino server is unable to clean up or destroy a thread that was spawned as a result of the agent execution. How can you troubleshoot this problem? Answer What follows is discussion about a method you can use to determine what threads are being spawned in the agent, which can give you insight into why Domino may not be able to destroy such a thread When executing a Java Agent on the server (either Server, AMgr, or HTTP), Domino creates a thread group with which additional dynamically spawned threads are associated. These threads can either be spawned by Domino code or other external code. When the agent terminates, Domino must ensure that all spawned threads are terminated, even if they are non-Domino threads. To do this, Domino steps through the Thread Group it created when loading the agent, and attempts to terminate or destroy all threads. If it finds a thread it cannot destroy, then it produces the message "Error cleaning up agent threads." This message means that a dynamically spawned thread has been left behind, possibly resulting in a thread leak, which could cause the server to exhaust its memory. Many conditions can result in this case, some of which are benign, others of which are not. For instance, if agent code declares a Java Thread, but does not start that thread, Domino will return an error when attempting to destroy it. However, since the thread was never started, this does not actually cause a problem. Other cases include the following: Not recycling a remote Corba Notes Session. Because a separate thread is spawned to handle the IIOP connection, if you do not recycle that session explicitly, then the thread will remain active. This will cause an error when Domino attempts to destroy the thread. This condition can cause moderate problems, but once the remote IIOP server times out the connection, this thread will terminate on its own. Using a third-party thread
Unresolved Topics Author Cloud Alex Zimarev Barry Shapiro Bob McGrath Bradley Ineichen Brandon M Kutsch Carl Tyler Chad Scott Dave Kern Doug Finner Howard D Greenberg Irina Khasin Jay Marme Jean-Pierre Bloch Jenifer P. Kidder Jochen Sack John Paganetti Jon S Albright Mark Gottschalk Mark Taylor Michael Blumentritt Mike Woolsey Okio OL Luna Rob Berendt Rodrigo San Vicente Wongo Wongo New Topic Share ▼ Subscribe ▼ Reply Tom http://www.ibm.com/support/docview.wss?uid=swg21141368 GriffithFeb 13, 2015 1:57 PM8 Posts Error cleaning up agent threadsCategory: Domino DesignerPlatform: WindowsRelease: 9.0Role: Tags: Replies: 1Hello. I have a Java agent which connects to Oracle (ojdbc6.jar driver), runs some Inserts and/or Deletes from tables, etc. I close() and recycle() everything that I can think of. Anyway, if it sits idle for a https://www-10.lotus.com/ldd/ndseforum.nsf/xpTopicThread.xsp?documentId=3F4ECE90D4F0F44985257DEB006829E2 while, the first run I get "Error cleaning up agent threads" the first time it runs (all the code seems to execute ok). Then subsequent runs of the agent the "error" disappears, as if the jvm is suddenly able to clean up all agent threads. If it sits agan, like the next day, same thing, first run, I get "Error cleaning up agent threads", then it's ok. Does anybody have any ideas as to what this could be. It's scary knowing this is out there. Thank you so much for reading. Bob McGrathFeb 13, 2015 5:26 PM71 Postsmight find something here ...http://www-10.lotus.com/ldd/46dom.nsf/Search?SearchView&Query=%22Error%20cleaning%20up%20agent%20threads%22&SearchOrder=0&Start=1&Count=100 New Topic Share ▼ Subscribe ▼ Reply Go elsewhereResourcesLotus SuportAbout All forums All wikis IBM developerWorks IBM SocialBiz UX Blog Forum use and etiquette Native Notes Access Web site feedback Forgot your password? Forgot your user name? Create new registration Update registration / password Lotus Support Browse technotes by product category Product documentation Upgrade Central About IBM Privacy
« vorheriges nächstes » Seiten: [1] Autor Thema: Java Agent "Error cleaning up agent threads" (Gelesen 9186 mal) machineslave Senior Mitglied Offline Geschlecht: Beiträge: 326 Java Agent "Error cleaning up agent threads" « am: 19.12.05 - 17:31:04 » Hallo,Ich habe einen Java-Agenten, der über JDBC Daten aus einer DB2 liest und in http://atnotes.de/index.php?topic=28200.0;prev_next=prev einer Notes-DB speichert. Der Agent läuft einwandfrei durch, allerdings bekomme ich auf der Konsole die Meldung "Error cleaning http://benpoole.com/weblog/200712070514 up agent threads". Wenn ich den Agenten des öfteren laufen lasse, so bekomme ich irgendwann eine Out of Memory Fehlermeldung.Ich habe auch schon die ganze Thematik bzgl. recycle() eingebaut, aber irgendwie komme ich da nicht weiter.Hier mal eine (verkürzte) Version meiner Java-Klassen:import lotus.domino.*;import java.sql.*;public class ImportAS400Data extends AgentBase { Log log; Session session; Database db; AgentContext agentContext; Document styleDoc; String username, system, password, error message library, param; public void NotesMain() {try { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Log log = session.createLog("Photoalbum"); log.openNotesLog("HierStehtDerServername", "develop\log.nsf"); db = agentContext.getCurrentDatabase(); View configView = db.getView("Configuration"); View activeJobView = db.getView("Active Job"); View inboxView = db.getView("($Inbox)"); Document activeDoc = error message error activeJobView.getFirstDocument(); Document as400Doc = configView.getDocumentByKey("AS400"); system = as400Doc.getItemValueString("AS400System"); username = as400Doc.getItemValueString("AS400User"); password = as400Doc.getItemValueString("AS400Password"); library = as400Doc.getItemValueString("AS400Library"); if (activeDoc == null) // Kein aktiver Job { activeDoc = inboxView.getFirstDocument(); if (activeDoc != null) // Neues Dokument gefunden { // Dokument in Job queue und ersten Agenten starten activeDoc.removeFromFolder("($Inbox)"); activeDoc.putInFolder("Active Job"); activeDoc.replaceItemValue("Agent", "imp_clr"); activeDoc.replaceItemValue("Status", "active"); activeDoc.save(true, false); param = activeDoc.getItemValueString("Subject"); log.logAction("Importing colors from AS/400: " + param); ImportColors colors = new ImportColors(system, username, password, library, db, param); log.logAction("Imported " + colors.getRecords() + " color records"); activeDoc.replaceIt
includes a handy method that can be walloped into your code to assess the state of your threads, and for some lo-fi memory profiling / troubleshooting, this can’t be beat. Well worth book-marking. Filed undermemory leaks, domino java Comments When will IBM fix this joke? One of the key features of Java is automatic garbage collection. Why oh why do java programmers on the Notes platform have to recycle() their objects????? Java programming in Notes is a clunky mess.Brendon Upson#I'm a total beginner with Java and keep running into weird errors that make no sense and the help doesn't help. I have seen this particular error and eventually gave up and rewrote my code in LotusScript. I never did figure out what the problem was.If I run this code and it tells me a certain thread is sitting out there, what am I supposed to do about it? I understand what recycle() does, but how on Earth am I supposed to know where to put it based on a thread ID?I'm not venting or whining at you, Ben, I'm just confused by what this is really telling me. :-) I agree with Brendon's assessment: "Java programming in Notes is a clunky mess."Charles Robinson#No no that’s fair enough Charles! Let me explain. Let’s say you get something like this in the console once your agent’s run: ThreadGroup UTG: MyAgent, objid = 1386529359 subgroups = 0 total threads = 3 Thread Name, ThreadID, ThreadGroup AgentThread: MyAgent, 82002511, UTG: MyAgent Three threads, but you finish with just one (that of the agent itself): this is good. If you finish with something like this though: Thread Name, ThreadID, ThreadGroup AgentThread: MyAgent, 82002511, UTG: MyAgent AnotherThread: SomeDbConnect, 82002512, UTG: DbObject … then you have something going wrong. It’s usually addressed by reviewing your code and ensuring that the relevant objects are disposed-of properly (e.g. in this example, ensuring that database connections are closed, and object drivers set to null).Does that help?Ben Poole#Yeah.. a little. It will probably make more sense as I do more with Java. It sounds like I'll end up back in the same mode I was with VB5: if you instantiate it you have to explicitly destroy it. With Java I get to add: and force garbage collection. A right clunky mess indeed. :-) Thanks for the explanation.Charles Robinson#I tend to defer object recycling and wot-not to a finally block where possible. It’s no panacea, but it helps!Ben Poole#@1 : is SWT a joke too cause we need to dispose() ? ;-)Michael Bourak#@6: yesBrendon Upson# It has to do with the way garbage colle