RE: [dbcp] GenericObjectPool.borrowObject() hangs
Hi Phil Steitz, I see that all threads are either BLOCKED or IN_NATIVE. I am attaching the entire jstack output. I set these parameters: maxActive: 5 validationQuery: select 1 from dual We don't set the following props (actually we have no way of setting this, Quartz sets these value, and it does not set this value): maxWait testOnBorrow testOnReturn maxIdle minEvictableIdleTimeMillis testWhileIdle timeBetweenEvictionRunsMillis testWhileIdle Arun Karthik Ravishankar -Original Message- From: Phil Steitz [mailto:phil.ste...@gmail.com] Sent: Friday, March 06, 2009 8:08 AM To: Commons Users List Subject: Re: [dbcp] GenericObjectPool.borrowObject() hangs Arun Karthik wrote: > Hi, > > Occasionally when the DB is taken down for maintenance my server hangs with > jmap similar to below: > I am not able to reproduce the same when I try to unplug the DB machine's > network cable or any other way I could think ok. > Could someone please guide me as to what the problem may be. > Can you provide the pool configuration settings - maxActive, maxWait, testOnBorrow, etc.? Also, are you sure *all* of the threads are blocked in this state. From the line numbers in the trace, it looks like you have maxWait set to a negative value, meaning that threads will block indefinitely waiting for connections to become available. The thread in the dump below is doing that - waiting for a connection to become available. Phil > I am using > > 1. quartz scheduler > > 2. commons-dbcp-1.2.1 > > 3. commons-pool-1.2 > > 4. Oracle RAC DB with thin client > > 5. ojdbc14.jar > > The Quartz Scheduler internally creates a Connection Pool and uses the > connection details like URL, UserID, PWD and maxConnections, and > validateQuery parameters/settings > > org.quartz.dataSource.lclDS.URL=jdbc:oracle:thin:@dbsrv:1521:XE > org.quartz.dataSource.lclDS.user=uname > org.quartz.dataSource.lclDS.password=pwd > org.quartz.dataSource.lclDS.driver=oracle.jdbc.OracleDriver > org.quartz.dataSource.lclDS.maxConnections=1 > org.quartz.dataSource.lclDS.validationQuery=select 1 from dual > > thread > dump-- > Thread 19804: (state = BLOCKED) > - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be > imprecise) > - java.lang.Object.wait() @bci=2, line=485 (Interpreted frame) > - org.apache.commons.pool.impl.GenericObjectPool.borrowObject() @bci=121, > line=748 (Interpreted frame) > - org.apache.commons.dbcp.PoolingDataSource.getConnection() @bci=4, line=95 > (Interpreted frame) > - org.apache.commons.dbcp.BasicDataSource.getConnection() @bci=4, line=540 > (Interpreted frame) > - org.quartz.utils.PoolingConnectionProvider.getConnection() @bci=4, > line=197 (Interpreted frame) > - org.quartz.utils.DBConnectionManager.getConnection(java.lang.String) > @bci=49, line=112 (Interpreted frame) > - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getDBConnection() @bci=6, > line=291 (Interpreted frame) > - > com.abcd.jobs.utils.ABCDJobSchedulerUtil.getJobs(javax.servlet.http.HttpServletRequest) > @bci=35, line=306 (Interpreted frame) > - org.apache.jsp.jobs_jsp._jspService(javax.servlet.http.HttpServletRequest, > javax.servlet.http.HttpServletResponse) @bci=121, line=110 (Interpreted frame) > - > org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, > javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame) > - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, > javax.servlet.ServletResponse) @bci=30, line=803 (Interpreted frame) > - > org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, > javax.servlet.http.HttpServletResponse, boolean) @bci=395, line=393 > (Interpreted frame) > - > org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, > javax.servlet.http.HttpServletResponse, java.lang.String, > java.lang.Throwable, boolean) @bci=134, line=320 (Interpreted frame) > - > org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, > javax.servlet.http.HttpServletResponse) @bci=436, line=266 (Interpreted > frame) > - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, > javax.servlet.ServletResponse) @bci=30, line=803 (Interpreted frame) > - > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, > javax.servlet.ServletResponse) @bci=374, line=290 (Interpreted frame) > - > org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, > javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame) > - > com.abcd.jobs.filters.SessionCheckFilter.doFilter(javax.servlet.ServletRequest, > javax.servlet.ServletResponse, javax.servlet.FilterChain) @bci=179, line=87 > (Interpreted frame) > - > org.apache.catalina.cor
Re: [dbcp] GenericObjectPool.borrowObject() hangs
Arun Karthik wrote: Hi, Occasionally when the DB is taken down for maintenance my server hangs with jmap similar to below: I am not able to reproduce the same when I try to unplug the DB machine's network cable or any other way I could think ok. Could someone please guide me as to what the problem may be. Can you provide the pool configuration settings - maxActive, maxWait, testOnBorrow, etc.? Also, are you sure *all* of the threads are blocked in this state. From the line numbers in the trace, it looks like you have maxWait set to a negative value, meaning that threads will block indefinitely waiting for connections to become available. The thread in the dump below is doing that - waiting for a connection to become available. Phil I am using 1. quartz scheduler 2. commons-dbcp-1.2.1 3. commons-pool-1.2 4. Oracle RAC DB with thin client 5. ojdbc14.jar The Quartz Scheduler internally creates a Connection Pool and uses the connection details like URL, UserID, PWD and maxConnections, and validateQuery parameters/settings org.quartz.dataSource.lclDS.URL=jdbc:oracle:thin:@dbsrv:1521:XE org.quartz.dataSource.lclDS.user=uname org.quartz.dataSource.lclDS.password=pwd org.quartz.dataSource.lclDS.driver=oracle.jdbc.OracleDriver org.quartz.dataSource.lclDS.maxConnections=1 org.quartz.dataSource.lclDS.validationQuery=select 1 from dual thread dump-- Thread 19804: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) - java.lang.Object.wait() @bci=2, line=485 (Interpreted frame) - org.apache.commons.pool.impl.GenericObjectPool.borrowObject() @bci=121, line=748 (Interpreted frame) - org.apache.commons.dbcp.PoolingDataSource.getConnection() @bci=4, line=95 (Interpreted frame) - org.apache.commons.dbcp.BasicDataSource.getConnection() @bci=4, line=540 (Interpreted frame) - org.quartz.utils.PoolingConnectionProvider.getConnection() @bci=4, line=197 (Interpreted frame) - org.quartz.utils.DBConnectionManager.getConnection(java.lang.String) @bci=49, line=112 (Interpreted frame) - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getDBConnection() @bci=6, line=291 (Interpreted frame) - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getJobs(javax.servlet.http.HttpServletRequest) @bci=35, line=306 (Interpreted frame) - org.apache.jsp.jobs_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=121, line=110 (Interpreted frame) - org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame) - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=803 (Interpreted frame) - org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) @bci=395, line=393 (Interpreted frame) - org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) @bci=134, line=320 (Interpreted frame) - org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=436, line=266 (Interpreted frame) - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=803 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=374, line=290 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame) - com.abcd.jobs.filters.SessionCheckFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) @bci=179, line=87 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=117, line=235 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame) - org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=804, line=233 (Interpreted frame) - org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=285, line=175 (Interpreted frame) - org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=64, line=128 (Interpreted frame) -
Re: [SCXML] more Evaluator/Context questions
On Thu, Mar 5, 2009 at 11:33 AM, Linda Erlenhov wrote: > Hello! > > This is my plan: > My guards are boolean expressions and the boolean variables that the > expression consists of are updated in "onEntry"/"onExit". I use a listner > for _when_ the update should be done. > Its better to model the state machine in as much completeness as possible using an SCXML document. Investigate whether you actually need to use a listener. See the canonical microwave samples or any datamodel test cases for examples of updates during and , here are the JEXL variants: http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/ > The trouble is that I´m not shure _where/how_ the updating is done. Since > this should be done during runtime a guess is that it is some kind of update > in the context, but I have clearly not understood properly how this > (context) works. > The Java API merely serves to support the mechanics of SCXML execution. Whether you need to understand it really depends on the nature of the usecase. Often, is sufficient for updating data model variables etc. > So if I create a simple example then maybe someone could use it to explain > this to me: > > The statemachine has three states. A, B and C. There are transitions between > A & B both ways, and also transitions between B & C both ways. You can > trigger events that are "go to A", "go to B" "go to C". You start in A. On > the transition from B to A there is a guard for "been in C" that is set when > you visit C. So you have to visit C atleast once before you enter state A > the second time. > > A<=>B<=>C > > How/where do I set the "been in C" state to true when i enter the state? > IIUC, use the 'beenInC' variable below in the guard condition for entering A the second time: ... ... -Rahul > > Best Regards > > //Linda > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [Commons NET]
I think you need to call the FTPClient completePendingCommand() method. Here's the example from API documentation... For example, InputStream input; OutputStream output; input = new FileInputStream("foobaz.txt"); output = ftp.storeFileStream("foobar.txt") if(!FTPReply.isPositiveIntermediate(ftp.getReplyCode())) { input.close(); output.close(); ftp.logout(); ftp.disconnect(); System.err.println("File transfer failed."); System.exit(1); } Util.copyStream(input, output); input.close(); output.close(); // Must call completePendingCommand() to finish command. if(!ftp.completePendingCommand()) { ftp.logout(); ftp.disconnect(); System.err.println("File transfer failed."); System.exit(1); } - Original Message - From: "Ward" To: "Commons Users List" Sent: Thursday, March 05, 2009 9:44 AM Subject: [Commons NET] > Hi, > > I'm using the Apache Commons NET library to ftp some files to a server. > I use the storeFileStream() method of FTPClient so I can write on the > OutputStream and keep track of the progress during the upload > This is (a summary of) the code: > > File file = File("location of file"); > FileInputStream fis = new FileInputStream(file); > FTPClient ftpClient = new FTPClent(); > ftpClient.connect(server-name); > ftpClient.login(user,pass); > ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); > OutputStream os = ftpClient.storeFileStream(file.getName()); > byte buf[] = new byte[1024]; > int len; > long totalLength = file.length(); > long bytesRead = 0; > long percent; > while ((len = fis.read(buf)) > 0) { > os.write(buf, 0, len); > bytesRead += len; > percent = (100 * bytesRead / totalLength); > } > fis.close(); > os.close(); > ftpClient.disconnect(); > > This seems to work fine: files get uploaded. > But when I take a closer look at the uploaded files, I notice they > aren't uploaded completely. > The uploaded files are all shorter than the original files on my disk > The difference is alway around the 59-60kb > What could be the reason for that? > Is there something wrong with the copy-ing-structure I use between the 2 > streams? > > Thanks for anwering > > Ward > > - > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[SCXML] more Evaluator/Context questions
Hello! This is my plan: My guards are boolean expressions and the boolean variables that the expression consists of are updated in "onEntry"/"onExit". I use a listner for _when_ the update should be done. The trouble is that I´m not shure _where/how_ the updating is done. Since this should be done during runtime a guess is that it is some kind of update in the context, but I have clearly not understood properly how this (context) works. So if I create a simple example then maybe someone could use it to explain this to me: The statemachine has three states. A, B and C. There are transitions between A & B both ways, and also transitions between B & C both ways. You can trigger events that are "go to A", "go to B" "go to C". You start in A. On the transition from B to A there is a guard for "been in C" that is set when you visit C. So you have to visit C atleast once before you enter state A the second time. A<=>B<=>C How/where do I set the "been in C" state to true when i enter the state? Best Regards //Linda
Re: [SCXML] Evaluating conditions
On Thu, Mar 5, 2009 at 9:04 AM, Anna Södling wrote: > Hi, > > When I run an SCXML-file with the Apache Commons engine, where/how are > the guards evaluated? oacs.Evaluator#evalCond(Context,String) > Or more exactly, is this done automatically or do > I have to write some code of my own to handle this? Automatically. > And (if it's done > automatically) what happens if the guard evaluates to false? Do I bounce > back/stay in the source-state then, or do I get an error? Stay in the same state(s). Not an error. -Rahul > > Sincerely, > Anna > > - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[SCXML] Evaluating conditions
Hi, When I run an SCXML-file with the Apache Commons engine, where/how are the guards evaluated? Or more exactly, is this done automatically or do I have to write some code of my own to handle this? And (if it's done automatically) what happens if the guard evaluates to false? Do I bounce back/stay in the source-state then, or do I get an error? Sincerely, Anna ___
[Commons NET]
Hi, I'm using the Apache Commons NET library to ftp some files to a server. I use the storeFileStream() method of FTPClient so I can write on the OutputStream and keep track of the progress during the upload This is (a summary of) the code: File file = File("location of file"); FileInputStream fis = new FileInputStream(file); FTPClient ftpClient = new FTPClent(); ftpClient.connect(server-name); ftpClient.login(user,pass); ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); OutputStream os = ftpClient.storeFileStream(file.getName()); byte buf[] = new byte[1024]; int len; long totalLength = file.length(); long bytesRead = 0; long percent; while ((len = fis.read(buf)) > 0) { os.write(buf, 0, len); bytesRead += len; percent = (100 * bytesRead / totalLength); } fis.close(); os.close(); ftpClient.disconnect(); This seems to work fine: files get uploaded. But when I take a closer look at the uploaded files, I notice they aren't uploaded completely. The uploaded files are all shorter than the original files on my disk The difference is alway around the 59-60kb What could be the reason for that? Is there something wrong with the copy-ing-structure I use between the 2 streams? Thanks for anwering Ward - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[LAUNCHER] Using procrun with commons launcher
Hi! I am using commons launcher to start my java application. This works pretty fine. Then when I want my java application to run as a windows service with procrun I am installing the service like this: "%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass LauncherBootstrap --StartParams -executablename;myapp;myapp --StartPath %myapp_BASE%\bin --StartMode jvm --LogPath %myapp_BASE%\logs --LogPrefix myapp Starting the application as a windows service works fine, too. But when I stop the windows service the service is stopped but my application (javaw process) is still running. I have to kill the process manually using task manager. Is it possible to use commons launcher und procrun on windows systems together? Has anyone made this working? thomas
[dbcp] GenericObjectPool.borrowObject() hangs
Hi, Occasionally when the DB is taken down for maintenance my server hangs with jmap similar to below: I am not able to reproduce the same when I try to unplug the DB machine's network cable or any other way I could think ok. Could someone please guide me as to what the problem may be. I am using 1. quartz scheduler 2. commons-dbcp-1.2.1 3. commons-pool-1.2 4. Oracle RAC DB with thin client 5. ojdbc14.jar The Quartz Scheduler internally creates a Connection Pool and uses the connection details like URL, UserID, PWD and maxConnections, and validateQuery parameters/settings org.quartz.dataSource.lclDS.URL=jdbc:oracle:thin:@dbsrv:1521:XE org.quartz.dataSource.lclDS.user=uname org.quartz.dataSource.lclDS.password=pwd org.quartz.dataSource.lclDS.driver=oracle.jdbc.OracleDriver org.quartz.dataSource.lclDS.maxConnections=1 org.quartz.dataSource.lclDS.validationQuery=select 1 from dual thread dump-- Thread 19804: (state = BLOCKED) - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise) - java.lang.Object.wait() @bci=2, line=485 (Interpreted frame) - org.apache.commons.pool.impl.GenericObjectPool.borrowObject() @bci=121, line=748 (Interpreted frame) - org.apache.commons.dbcp.PoolingDataSource.getConnection() @bci=4, line=95 (Interpreted frame) - org.apache.commons.dbcp.BasicDataSource.getConnection() @bci=4, line=540 (Interpreted frame) - org.quartz.utils.PoolingConnectionProvider.getConnection() @bci=4, line=197 (Interpreted frame) - org.quartz.utils.DBConnectionManager.getConnection(java.lang.String) @bci=49, line=112 (Interpreted frame) - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getDBConnection() @bci=6, line=291 (Interpreted frame) - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getJobs(javax.servlet.http.HttpServletRequest) @bci=35, line=306 (Interpreted frame) - org.apache.jsp.jobs_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=121, line=110 (Interpreted frame) - org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame) - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=803 (Interpreted frame) - org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) @bci=395, line=393 (Interpreted frame) - org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) @bci=134, line=320 (Interpreted frame) - org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=436, line=266 (Interpreted frame) - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=803 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=374, line=290 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame) - com.abcd.jobs.filters.SessionCheckFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) @bci=179, line=87 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=117, line=235 (Interpreted frame) - org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame) - org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=804, line=233 (Interpreted frame) - org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=285, line=175 (Interpreted frame) - org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=64, line=128 (Interpreted frame) - org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=6, line=102 (Interpreted frame) - org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request, org.apache.catalina.connector.Response) @bci=42, line=109 (Interpreted frame) - org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) @bci=157, line=263 (In
[beanutils] testing around ConvertUtils
In my unit tests I sometimes have the situation where I need to register my custom converters for ConvertUtils in order to make everything behave as it would in real life. Normally the conversions are incidental to the test so it seems unnecessary to need to set up ConvertUtils. Seeing inside the ConvertUtils class that there is a ConvertUtilsBean, I had the idea of using the ConvertUtilsBean in my classes, and initializing it via dependency injection. Then I could mock it. However all access to the ConvertUtilsBean via the singleton getInstance factory method is protected. Would it be unwise to instantiate it myself in my dependency injection container? Thanks Adam - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org