{"action":"created","issue":{"url":"https://api.github.com/repos/marytts/marytts/issues/521","repository_url":"https://api.github.com/repos/marytts/marytts","labels_url":"https://api.github.com/repos/marytts/marytts/issues/521/labels{/name}","comments_url":"https://api.github.com/repos/marytts/marytts/issues/521/comments","events_url":"https://api.github.com/repos/marytts/marytts/issues/521/events","html_url":"https://github.com/marytts/marytts/issues/521","id":152989227,"number":521,"title":"Marytts within tomcat application server creates a memory leak","user":{"login":"netzverb","id":16766560,"avatar_url":"https://avatars.githubusercontent.com/u/16766560?v=3","gravatar_id":"","url":"https://api.github.com/users/netzverb","html_url":"https://github.com/netzverb","followers_url":"https://api.github.com/users/netzverb/followers","following_url":"https://api.github.com/users/netzverb/following{/other_user}","gists_url":"https://api.github.com/users/netzverb/gists{/gist_id}","starred_url":"https://api.github.com/users/netzverb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netzverb/subscriptions","organizations_url":"https://api.github.com/users/netzverb/orgs","repos_url":"https://api.github.com/users/netzverb/repos","events_url":"https://api.github.com/users/netzverb/events{/privacy}","received_events_url":"https://api.github.com/users/netzverb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/marytts/marytts/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-05-04T11:28:25Z","updated_at":"2016-05-06T10:40:39Z","closed_at":"2016-05-06T10:40:39Z","body":"I'm testing marytts to run within a web application on tomcat application server. There is a servlet that converts the text request to an audio response. All needed marytts libs are in the WEB-INF/lib directory.\r\n\r\n```\r\npublic void doGet(HttpServletRequest _request, HttpServletResponse _response) {\r\n  ...\r\n  MaryInterface marytts = new LocalMaryInterface();\r\n  AudioInputStream in = marytts.generateAudio(\"This is my text.\");\r\n  ServletOutputStream out = _response.getOutputStream();\r\n  AudioSystem.write(in, AudioFileFormat.Type.WAVE, op);\r\n  ...\r\n}\r\n```\r\nEach request to the web application starts a new marytts thread which doesn't stops. These threads are idle, but after 100 and more requests all memory of the application server is used and the server goes down.\r\n\r\n```\r\nThread: Thread-15 WAITING Priority: 5 Daemon\r\nsun.misc.Unsafe.park(Native Method)\r\njava.util.concurrent.locks.LockSupport.park(Unknown Source)\r\njava.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)\r\njava.util.concurrent.ArrayBlockingQueue.put(Unknown Source)\r\nmarytts.util.data.ProducingDoubleDataSource.putOneDataPoint(ProducingDoubleDataSource.java:75)\r\nmarytts.htsengine.HTSVocoder.htsMLSAVocoder(HTSVocoder.java:495)\r\nmarytts.htsengine.HTSVocoder$HTSVocoderDataProducer.run(HTSVocoder.java:1651)\r\njava.lang.Thread.run(Unknown Source)\r\n```\r\nIt seems that the local marytts runtime isn't reused or there is a problem to stop the threads. Here a log entry of catalina.log:\r\n```\r\nThe web application [] appears to have started a thread named [Thread-15] but has failed to stop it. This is very likely to create a memory leak.\r\n```\r\nAny idea? Thanks :-)\r\nAndreas"},"comment":{"url":"https://api.github.com/repos/marytts/marytts/issues/comments/217408573","html_url":"https://github.com/marytts/marytts/issues/521#issuecomment-217408573","issue_url":"https://api.github.com/repos/marytts/marytts/issues/521","id":217408573,"user":{"login":"netzverb","id":16766560,"avatar_url":"https://avatars.githubusercontent.com/u/16766560?v=3","gravatar_id":"","url":"https://api.github.com/users/netzverb","html_url":"https://github.com/netzverb","followers_url":"https://api.github.com/users/netzverb/followers","following_url":"https://api.github.com/users/netzverb/following{/other_user}","gists_url":"https://api.github.com/users/netzverb/gists{/gist_id}","starred_url":"https://api.github.com/users/netzverb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netzverb/subscriptions","organizations_url":"https://api.github.com/users/netzverb/orgs","repos_url":"https://api.github.com/users/netzverb/repos","events_url":"https://api.github.com/users/netzverb/events{/privacy}","received_events_url":"https://api.github.com/users/netzverb/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T10:40:39Z","updated_at":"2016-05-06T10:40:39Z","body":"@psibre: You can close this question. I found a configuration wich works. Now I use the German voice `bits3` an set the mary base with `System.setProperty(\"mary.base\", \"P:\\ath\")`. I think, the mary base was the key. Without this, the threads goes in an undefined state.\r\n\r\n@FabianWelz + @psibre: Thanks for your answers :-)\r\n\r\n"}}