You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Bengt Rodehav <be...@rodehav.com> on 2012/01/12 15:36:22 UTC

Re: How to configure transaction timeout?

Hello again Alasdair,

I finally got around to test configuration of Aries Transaction. I created
the following configuration (using PID org.apache.aries.transaction):

aries.transaction.timeout=1
aries.transaction.howl.logFileDir=${karaf.data}/txlog/

I set the logfile directory as well as the transaction timeout (I peeked at
how they do it in Servicemix). I set the timeout to a low value in order to
test that I actually get a transaction timeout. I also perform a 5s sleep
in a transacted method to force a transaction timeout.

But, I never get a transaction timeout and I never get a transaction log
file in the "logFileDir" directory. I'm not beginning to fear that my
methods are not transacted. How can I verify this?

Under what circumstances would a transaction log file be created? I assumed
that it would be created when the first transaction was created. Or, do I
also need to add the following line?

aries.transaction.recoverable=true

I've tried that but still no logfile was created.

I also noticed that the default value for
"aries.transaction.howl.maxBuffers" is 0 while the default value for
"aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
would think it should be the other way around.

/Bengt







2011/12/29 Bengt Rodehav <be...@rodehav.com>

> Thanks Alasdair - will look into it.
>
> /Bengt
>
>
> 2011/12/28 Alasdair Nottingham <no...@apache.org>
>
>> Hi,
>>
>> The pid for configuring transactions is "org.apache.aries.transaction".
>>
>> Alasdair
>>
>>
>> On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>>
>>> It turned out that my error was not due to the transaction timing out
>>> but to violation of unique constraints. Nevertheless, I would like to know
>>> how to control the transaction timeout in Aries transaction.
>>>
>>> /Bengt
>>>
>>>
>>> 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>>>
>>>> Thanks for your reply David,
>>>>
>>>> I'll see if I can figure out the pid although this seems like something
>>>> that really needs to be documented in Aries. If the default timeout is 600
>>>> seconds then this is probably not the reason of the errors I see. I need a
>>>> time out of about 30 s which then is much less than the default.
>>>>
>>>> I have been using MySql but I'm in the process of switching to SQL
>>>> Server 2005. MySql worked fine but I started having problems committing the
>>>> longer transactions with SQL Server 2005 which caused me to suspect a
>>>> transaction timeout. Perhaps the timeout is not propagated to SQL Server
>>>> like you hinted.
>>>>
>>>> /Bengt
>>>>
>>>>
>>>> 2011/12/14 David Jencks <da...@yahoo.com>
>>>>
>>>>> Transaction is set up as a managed service factory.  I haven't figured
>>>>> out exactly how this results in a tm instance without any visible
>>>>> configuration.
>>>>>
>>>>> If you can figure out what is triggering the creation of a tm and the
>>>>> pid, the property to set is called aries.transaction.timeout and the
>>>>> default value is 600 (seconds) or 10 minutes.
>>>>>
>>>>> If you thing some of the resource managers might be timing out
>>>>> earlier, let me know.  I'm not sure we are propagating the tm timeout to
>>>>> the resource managers in each transaction.
>>>>>
>>>>> thanks
>>>>> david jencks
>>>>>
>>>>> On Dec 13, 2011, at 2:10 PM, Bengt Rodehav wrote:
>>>>>
>>>>> I use Aries JPA and Aries Transaction with OpenJpa. I have problems
>>>>> with some long transactions that time out (I think anyway). I cannot see
>>>>> where I can configure the transaction timeout for Aries Transaction. The
>>>>> only interaction I have with Aries Transaction is my blueprint definition
>>>>> where I create beans with transaction properties set and publish them as
>>>>> services. Below is an example of one of my blueprint definitions.
>>>>>
>>>>> Can anyone advice me as to how one can configure the transacation
>>>>> timeout? (and what is the default?)
>>>>>
>>>>> *<?xml version="1.0" encoding="UTF-8"?>*
>>>>> *<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"*
>>>>> *  xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>>>>> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"*
>>>>> *  xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0">*
>>>>> *
>>>>> *
>>>>> *  <bean id="statementService"
>>>>> class="se.digia.skistory.domain.impl.StatementService">*
>>>>> *    <tx:transaction method="*" value="Required" />*
>>>>> *    <jpa:context property="entityManager" unitname="skistPU" />*
>>>>> *  </bean>*
>>>>> *
>>>>> *
>>>>> *  <service ref="statementService"
>>>>> interface="se.digia.skistory.domain.api.IStatementService">*
>>>>> *  </service>*
>>>>> *
>>>>> *
>>>>> *  <bean id="customerService"
>>>>> class="se.digia.skistory.domain.impl.CustomerService">*
>>>>> *    <tx:transaction method="*" value="Required" />*
>>>>> *    <jpa:context property="entityManager" unitname="skistPU" />*
>>>>> *  </bean>*
>>>>> *
>>>>> *
>>>>> *  <service ref="customerService"
>>>>> interface="se.digia.skistory.domain.api.ICustomerService">*
>>>>> *  </service>*
>>>>> *
>>>>> *
>>>>> *</blueprint>*
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Alasdair Nottingham
>> not@apache.org
>>
>
>

Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for the tip but it just seems easier to stay with the Aries
ecosystem. I think Geronimo TM has a pretty good reputation - doesn't it
support XA as well?

/Bengt

2012/1/13 Łukasz Dywicki <lu...@code-house.org>

> Just as an note,
> You can always switch to atomikos which supports transaction timeout and
> test. It runs well under the OSGi. We already did that to have XA, but it
> might not be a case for you.
>
> Best regards,
> Łukasz Dywicki
> --
> Code-House
> http://code-house.org
>
> Wiadomość napisana przez Bengt Rodehav w dniu 2012-01-12, o godz. 22:26:
>
> I took a look at the transaction related itests and I can't see any tests
> regarding the transaction timeout - they seem to be focused on testing the
> transaction attributes. Could it be that the transaction timeout has never
> been tested?
>
> Regarding the transaction log I'm not sure how this is supposed to work -
> perhaps someone can enlighten me. Shouldn't every transaction be written to
> a transaction log file?
>
> /Bengt
>
> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>
>>
>> David,
>>
>> I have verified that the configuration is applied to the transaction
>> service I just can't see that it has any effect. I guess I can start
>> debugging but I was hoping to avoid that. Do you know if there are any
>> integration tests that tests the transaction timeout?
>>
>> /Bengt
>>
>>
>> Den torsdagen den 12:e januari 2012 skrev David Jencks<
>> david_jencks@yahoo.com>:
>>
>> > I would guess that perhaps your configuration is not actually getting
>> supplied to the managed service?  If you are running in karaf you can use
>> confiig:list to make sure config admin is aware of your config.  You might
>> also want to debug the aries code and make sure that  the configuration is
>> actually getting supplied to the service.
>> > david jencks
>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>> >
>> > Hello again Alasdair,
>> > I finally got around to test configuration of Aries Transaction. I
>> created the following configuration (using
>> PID org.apache.aries.transaction):
>> > aries.transaction.timeout=1
>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>> > I set the logfile directory as well as the transaction timeout (I
>> peeked at how they do it in Servicemix). I set the timeout to a low value
>> in order to test that I actually get a transaction timeout. I also perform
>> a 5s sleep in a transacted method to force a transaction timeout.
>> > But, I never get a transaction timeout and I never get a transaction
>> log file in the "logFileDir" directory. I'm not beginning to fear that my
>> methods are not transacted. How can I verify this?
>> > Under what circumstances would a transaction log file be created? I
>> assumed that it would be created when the first transaction was created.
>> Or, do I also need to add the following line?
>> > aries.transaction.recoverable=true
>> > I've tried that but still no logfile was created.
>> > I also noticed that the default value for
>> "aries.transaction.howl.maxBuffers" is 0 while the default value for
>> "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
>> would think it should be the other way around.
>> > /Bengt
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>> >
>> > Thanks Alasdair - will look into it.
>> > /Bengt
>> >
>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>> >
>> > Hi,
>> > The pid for configuring transactions is "org.apache.aries.transaction".
>> > Alasdair
>> >
>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>> >
>> > It turned out that my error was not due to the transaction timing out
>> but to violation of unique constraints. Nevertheless, I would like to know
>> how to control the transaction timeout in Aries transaction.
>> > /Bengt
>> >
>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>> >
>> > Thanks for your reply David,
>> > I'll see if I can figure out the pid although this seems like something
>> that really needs to be documented in Aries. If the default timeout is 600
>> seconds then this is probably not the reason of the errors I see. I need a
>> time out of about 30 s which then is much less than the default.
>> > I have been using MySql but I'm in the process of switching to SQL
>> Server 2005. MySql worked fine but I started having problems committing the
>> longer transactions with SQL Server 2005 which caused me to suspect a
>> transaction timeout. Perhaps the timeout is not propagated to SQL Server
>> like you hinted.
>> > /Bengt
>> >
>> > 2011/12/14 David Jencks <da...@yahoo.com>
>> >
>> > Transaction is set up as a managed service factory.  I haven't figured
>> out exactly how this results in a tm instance without any visible
>> configuration.
>> > If you can figure out what is triggering the creation of a tm and the
>> pid, the property to set is called aries.transaction.timeout and the
>> default value is 600 (seconds) or 10 minutes.
>>
>
>
>

Re: How to configure transaction timeout?

Posted by Łukasz Dywicki <lu...@code-house.org>.
Just as an note,
You can always switch to atomikos which supports transaction timeout and test. It runs well under the OSGi. We already did that to have XA, but it might not be a case for you.

Best regards,
Łukasz Dywicki
--
Code-House
http://code-house.org

Wiadomość napisana przez Bengt Rodehav w dniu 2012-01-12, o godz. 22:26:

> I took a look at the transaction related itests and I can't see any tests regarding the transaction timeout - they seem to be focused on testing the transaction attributes. Could it be that the transaction timeout has never been tested?
> 
> Regarding the transaction log I'm not sure how this is supposed to work - perhaps someone can enlighten me. Shouldn't every transaction be written to a transaction log file?
> 
> /Bengt
> 
> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
> 
> David,
> 
> I have verified that the configuration is applied to the transaction service I just can't see that it has any effect. I guess I can start debugging but I was hoping to avoid that. Do you know if there are any integration tests that tests the transaction timeout?
> 
> /Bengt
> 
> 
> Den torsdagen den 12:e januari 2012 skrev David Jencks<da...@yahoo.com>:
> 
> > I would guess that perhaps your configuration is not actually getting supplied to the managed service?  If you are running in karaf you can use confiig:list to make sure config admin is aware of your config.  You might also want to debug the aries code and make sure that  the configuration is actually getting supplied to the service.
> > david jencks
> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
> >
> > Hello again Alasdair,
> > I finally got around to test configuration of Aries Transaction. I created the following configuration (using PID org.apache.aries.transaction):
> > aries.transaction.timeout=1
> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
> > I set the logfile directory as well as the transaction timeout (I peeked at how they do it in Servicemix). I set the timeout to a low value in order to test that I actually get a transaction timeout. I also perform a 5s sleep in a transacted method to force a transaction timeout.
> > But, I never get a transaction timeout and I never get a transaction log file in the "logFileDir" directory. I'm not beginning to fear that my methods are not transacted. How can I verify this?
> > Under what circumstances would a transaction log file be created? I assumed that it would be created when the first transaction was created. Or, do I also need to add the following line?
> > aries.transaction.recoverable=true
> > I've tried that but still no logfile was created.
> > I also noticed that the default value for "aries.transaction.howl.maxBuffers" is 0 while the default value for "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I would think it should be the other way around.
> > /Bengt
> >
> >
> >
> >
> >
> >
> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
> >
> > Thanks Alasdair - will look into it.
> > /Bengt
> >
> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
> >
> > Hi,
> > The pid for configuring transactions is "org.apache.aries.transaction".
> > Alasdair
> >
> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
> >
> > It turned out that my error was not due to the transaction timing out but to violation of unique constraints. Nevertheless, I would like to know how to control the transaction timeout in Aries transaction.
> > /Bengt
> >
> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
> >
> > Thanks for your reply David,
> > I'll see if I can figure out the pid although this seems like something that really needs to be documented in Aries. If the default timeout is 600 seconds then this is probably not the reason of the errors I see. I need a time out of about 30 s which then is much less than the default.
> > I have been using MySql but I'm in the process of switching to SQL Server 2005. MySql worked fine but I started having problems committing the longer transactions with SQL Server 2005 which caused me to suspect a transaction timeout. Perhaps the timeout is not propagated to SQL Server like you hinted.
> > /Bengt
> >
> > 2011/12/14 David Jencks <da...@yahoo.com>
> >
> > Transaction is set up as a managed service factory.  I haven't figured out exactly how this results in a tm instance without any visible configuration.
> > If you can figure out what is triggering the creation of a tm and the pid, the property to set is called aries.transaction.timeout and the default value is 600 (seconds) or 10 minutes.
> 


Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
I created the following JIRA:

https://issues.apache.org/jira/browse/ARIES-809

/Bengt

2012/1/15 Guillaume Nodet <gn...@gmail.com>

> One feature i'd like to keep from the current tx mgr, is that it's exposed
> as a Spring tx mgr too which helps when using spring.  Other than that I
> dont't have much problem.
>
>
>
> On Friday, January 13, 2012, David Jencks <da...@yahoo.com> wrote:
> > I bet I know what's going on... setting the tx timeout only applies to
> that thread and the next transaction on that thread.  There's a default
> transaction timeout milliseconds that can only be set in the tm
> constructor.  This is not a suitable model for osgi configuration.
> > In my geronimo sandbox I refactored the tm so it has better osgi
> structure.  Maybe we should work to release that.  It would pretty much
> replace the aries tm.
> > david jencks
> > On Jan 13, 2012, at 7:34 AM, Bengt Rodehav wrote:
> >
> > I have now tested to sleep 650 s which exceeds the default transaction
> timeout of 600 s. This gives me an exception due to transaction timeout.
> Thus Geronimo transaction timeout works.
> > I then configure the transaction timeout to 30 s (in the manner I've
> described previously) and sleep for 60 s in order to force a transaction
> timeout. I don't get a transaction timeout.
> > To be sure I then checked to see if the configuration was bound and it
> wasn't! I had just made a fresh start of Karaf (by deleting the bundle
> cache). I also tried doing a refresh but the configuration was still
> unbound. I then restarted Karaf (without clearing the bundle cache) and
> after that the configuration was bound.
> > However, even after my configuration was bound the test I did still did
> not provoke a transaction timeout.
> > I think there must be something wrong with the way Aries transaction
> picks up its configuration - perhaps some timing issue.
> > Also, even when the configuration is bound, it still doesn't seem to
> affect the transaction manager. Perhaps the transaction manager is created
> to soon and then not recreated when configuration updates are pushed by
> config admin?
> > Can anyone explain this? Has anyone been able to configure the
> transaction manager at all?
> > /Bengt
> >
> > 2012/1/13 Bengt Rodehav <be...@rodehav.com>
> >
> > David,
> > That test is almost identical to what I did in my code. The difference
> is that I don't explicitly access the transaction manager like you do. I
> use blueprint to make my method transactional (with the "Requires"
> transaction attribute) and I configure the transaction timeout via Config
> Admin.
> > I never doubted that Geronimo's transaction timeout worked but I wonder
> if Aries is setting the properties correctly. I will make a test where I
> sleep for longer than the default timeout (600 s) to see if that would
> trigger an exception. If so, then the problem is how to configure the
> timeout correctly.
> > /Bengt
> >
> > 2012/1/13 David Jencks <da...@yahoo.com>
> >
> > On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:
> >
> > David, do you think I should create a JIRA for this? I don't know for
> sure whether I'm doing anything wrong or not but I think it makes sense to
> add an integration test for the transaction timeout anyway.
> >
> > I looked and geronimo has a timeout test like this:
> >     public void testTimeout() throws Exception
> >     {
> >         long timeout = tm.getTransactionTimeoutMilliseconds(0L);
> >         tm.setTransactionTimeout((int)timeout/4000);
> >         tm.begin();
> >         System.out.println("Test to sleep for " + timeout + "
> millisecs");
> >         Thread.sleep(timeout);
> >         try
> >         {
> >             tm.commit();
> >             fail("Tx Should get Rollback exception");
> >         }catch(RollbackException rex)
> >         {
> >             // Caught expected exception
> >         }
> >         // Now test if the default timeout is active
> >         tm.begin();
> >         System.out.println("Test to sleep for " + (timeout/2) + "
> millisecs");
> >         Thread.sleep((timeout/2));
> >         tm.commit();
> >         // Its a failure if exception occurs.
> >     }
> >
> > So I tend to think timeout works.  Is what's tested for here what you
> observe in your code?
> > thanks
> > david jencks
> >
> > I'm currently just using one resource manager (SQL Server 2005) which I
> guess means that no transaction log is necessary. Thanks for explaining.
> > /Bengt
> >
> > 2012/1/13 David Jencks <da...@yahoo.com>
> >
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> ------------------------
> FuseSource, Integration everywhere
> http://fusesource.com
>

Re: How to configure transaction timeout?

Posted by Guillaume Nodet <gn...@gmail.com>.
One feature i'd like to keep from the current tx mgr, is that it's exposed
as a Spring tx mgr too which helps when using spring.  Other than that I
dont't have much problem.


On Friday, January 13, 2012, David Jencks <da...@yahoo.com> wrote:
> I bet I know what's going on... setting the tx timeout only applies to
that thread and the next transaction on that thread.  There's a default
transaction timeout milliseconds that can only be set in the tm
constructor.  This is not a suitable model for osgi configuration.
> In my geronimo sandbox I refactored the tm so it has better osgi
structure.  Maybe we should work to release that.  It would pretty much
replace the aries tm.
> david jencks
> On Jan 13, 2012, at 7:34 AM, Bengt Rodehav wrote:
>
> I have now tested to sleep 650 s which exceeds the default transaction
timeout of 600 s. This gives me an exception due to transaction timeout.
Thus Geronimo transaction timeout works.
> I then configure the transaction timeout to 30 s (in the manner I've
described previously) and sleep for 60 s in order to force a transaction
timeout. I don't get a transaction timeout.
> To be sure I then checked to see if the configuration was bound and it
wasn't! I had just made a fresh start of Karaf (by deleting the bundle
cache). I also tried doing a refresh but the configuration was still
unbound. I then restarted Karaf (without clearing the bundle cache) and
after that the configuration was bound.
> However, even after my configuration was bound the test I did still did
not provoke a transaction timeout.
> I think there must be something wrong with the way Aries transaction
picks up its configuration - perhaps some timing issue.
> Also, even when the configuration is bound, it still doesn't seem to
affect the transaction manager. Perhaps the transaction manager is created
to soon and then not recreated when configuration updates are pushed by
config admin?
> Can anyone explain this? Has anyone been able to configure the
transaction manager at all?
> /Bengt
>
> 2012/1/13 Bengt Rodehav <be...@rodehav.com>
>
> David,
> That test is almost identical to what I did in my code. The difference is
that I don't explicitly access the transaction manager like you do. I use
blueprint to make my method transactional (with the "Requires" transaction
attribute) and I configure the transaction timeout via Config Admin.
> I never doubted that Geronimo's transaction timeout worked but I wonder
if Aries is setting the properties correctly. I will make a test where I
sleep for longer than the default timeout (600 s) to see if that would
trigger an exception. If so, then the problem is how to configure the
timeout correctly.
> /Bengt
>
> 2012/1/13 David Jencks <da...@yahoo.com>
>
> On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:
>
> David, do you think I should create a JIRA for this? I don't know for
sure whether I'm doing anything wrong or not but I think it makes sense to
add an integration test for the transaction timeout anyway.
>
> I looked and geronimo has a timeout test like this:
>     public void testTimeout() throws Exception
>     {
>         long timeout = tm.getTransactionTimeoutMilliseconds(0L);
>         tm.setTransactionTimeout((int)timeout/4000);
>         tm.begin();
>         System.out.println("Test to sleep for " + timeout + " millisecs");
>         Thread.sleep(timeout);
>         try
>         {
>             tm.commit();
>             fail("Tx Should get Rollback exception");
>         }catch(RollbackException rex)
>         {
>             // Caught expected exception
>         }
>         // Now test if the default timeout is active
>         tm.begin();
>         System.out.println("Test to sleep for " + (timeout/2) + "
millisecs");
>         Thread.sleep((timeout/2));
>         tm.commit();
>         // Its a failure if exception occurs.
>     }
>
> So I tend to think timeout works.  Is what's tested for here what you
observe in your code?
> thanks
> david jencks
>
> I'm currently just using one resource manager (SQL Server 2005) which I
guess means that no transaction log is necessary. Thanks for explaining.
> /Bengt
>
> 2012/1/13 David Jencks <da...@yahoo.com>
>

-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
OK - that clarifies things quite a bit.

Is it only the transaction timeout that is set in the constructor or are
all the configurable properties set in the constructor (like the logFileDir
property)?

Given that design I assume that a new transaction manager would have to be
created (and published as a service) for every configuration change or it
must be possible to update the properties of the transaction manager after
it has been instantiated.

I'm still not sure why it was so hard to get the configuration bound to the
service but I do understand that the order of activation is probably very
important if the configuration can only take effect if it is done before
the transaction manager is created.

Can you create a JIRA for this David or shall I? I really think this needs
to be fixed either by using your OSGi enabled Geronimo transaction or by
fixing things in Aries transaction.

/Bengt

2012/1/13 David Jencks <da...@yahoo.com>

> I bet I know what's going on... setting the tx timeout only applies to
> that thread and the next transaction on that thread.  There's a default
> transaction timeout milliseconds that can only be set in the tm
> constructor.  This is not a suitable model for osgi configuration.
>
> In my geronimo sandbox I refactored the tm so it has better osgi
> structure.  Maybe we should work to release that.  It would pretty much
> replace the aries tm.
>
> david jencks
>
> On Jan 13, 2012, at 7:34 AM, Bengt Rodehav wrote:
>
> I have now tested to sleep 650 s which exceeds the default transaction
> timeout of 600 s. This gives me an exception due to transaction timeout.
> Thus Geronimo transaction timeout works.
>
> I then configure the transaction timeout to 30 s (in the manner I've
> described previously) and sleep for 60 s in order to force a transaction
> timeout. I don't get a transaction timeout.
>
> To be sure I then checked to see if the configuration was bound and it
> wasn't! I had just made a fresh start of Karaf (by deleting the bundle
> cache). I also tried doing a refresh but the configuration was still
> unbound. I then restarted Karaf (without clearing the bundle cache) and
> after that the configuration was bound.
>
> However, even after my configuration was bound the test I did still did
> not provoke a transaction timeout.
>
> I think there must be something wrong with the way Aries transaction picks
> up its configuration - perhaps some timing issue.
>
> Also, even when the configuration is bound, it still doesn't seem to
> affect the transaction manager. Perhaps the transaction manager is created
> to soon and then not recreated when configuration updates are pushed by
> config admin?
>
> Can anyone explain this? Has anyone been able to configure the transaction
> manager at all?
>
> /Bengt
>
>
> 2012/1/13 Bengt Rodehav <be...@rodehav.com>
>
>> David,
>>
>> That test is almost identical to what I did in my code. The difference is
>> that I don't explicitly access the transaction manager like you do. I use
>> blueprint to make my method transactional (with the "Requires" transaction
>> attribute) and I configure the transaction timeout via Config Admin.
>>
>> I never doubted that Geronimo's transaction timeout worked but I wonder
>> if Aries is setting the properties correctly. I will make a test where I
>> sleep for longer than the default timeout (600 s) to see if that would
>> trigger an exception. If so, then the problem is how to configure the
>> timeout correctly.
>>
>> /Bengt
>>
>> 2012/1/13 David Jencks <da...@yahoo.com>
>>
>>>
>>> On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:
>>>
>>> David, do you think I should create a JIRA for this? I don't know for
>>> sure whether I'm doing anything wrong or not but I think it makes sense to
>>> add an integration test for the transaction timeout anyway.
>>>
>>>
>>> I looked and geronimo has a timeout test like this:
>>>
>>>     public void testTimeout() throws Exception
>>>     {
>>>         long timeout = tm.getTransactionTimeoutMilliseconds(0L);
>>>         tm.setTransactionTimeout((int)timeout/4000);
>>>         tm.begin();
>>>         System.out.println("Test to sleep for " + timeout + "
>>> millisecs");
>>>         Thread.sleep(timeout);
>>>         try
>>>         {
>>>             tm.commit();
>>>             fail("Tx Should get Rollback exception");
>>>         }catch(RollbackException rex)
>>>         {
>>>             // Caught expected exception
>>>         }
>>>
>>>         // Now test if the default timeout is active
>>>         tm.begin();
>>>         System.out.println("Test to sleep for " + (timeout/2) + "
>>> millisecs");
>>>         Thread.sleep((timeout/2));
>>>         tm.commit();
>>>         // Its a failure if exception occurs.
>>>     }
>>>
>>>
>>> So I tend to think timeout works.  Is what's tested for here what you
>>> observe in your code?
>>>
>>> thanks
>>> david jencks
>>>
>>>
>>> I'm currently just using one resource manager (SQL Server 2005) which I
>>> guess means that no transaction log is necessary. Thanks for explaining.
>>>
>>> /Bengt
>>>
>>> 2012/1/13 David Jencks <da...@yahoo.com>
>>>
>>>>
>>>> On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:
>>>>
>>>> I took a look at the transaction related itests and I can't see any
>>>> tests regarding the transaction timeout - they seem to be focused on
>>>> testing the transaction attributes. Could it be that the transaction
>>>> timeout has never been tested?
>>>>
>>>>
>>>> probably not in aries since the tm implementation is from geronimo.  I
>>>> did think there were some osgi tx timeout tests but I dont have access
>>>> right now.
>>>>
>>>>
>>>> Regarding the transaction log I'm not sure how this is supposed to work
>>>> - perhaps someone can enlighten me. Shouldn't every transaction be written
>>>> to a transaction log file?
>>>>
>>>>
>>>> Every successfully prepared transaction with at least two participating
>>>> resource managers will have a log record written for prepare and another
>>>> written for commit.  Transaction with only one participant don't need
>>>> logging.
>>>>
>>>> thanks
>>>> david jencks
>>>>
>>>>
>>>> /Bengt
>>>>
>>>> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>>>>
>>>>>
>>>>> David,
>>>>>
>>>>> I have verified that the configuration is applied to the transaction
>>>>> service I just can't see that it has any effect. I guess I can start
>>>>> debugging but I was hoping to avoid that. Do you know if there are any
>>>>> integration tests that tests the transaction timeout?
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>> Den torsdagen den 12:e januari 2012 skrev David Jencks<
>>>>> david_jencks@yahoo.com>:
>>>>>
>>>>> > I would guess that perhaps your configuration is not actually
>>>>> getting supplied to the managed service?  If you are running in karaf you
>>>>> can use confiig:list to make sure config admin is aware of your config.
>>>>>  You might also want to debug the aries code and make sure that  the
>>>>> configuration is actually getting supplied to the service.
>>>>> > david jencks
>>>>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>>>>> >
>>>>> > Hello again Alasdair,
>>>>> > I finally got around to test configuration of Aries Transaction. I
>>>>> created the following configuration (using
>>>>> PID org.apache.aries.transaction):
>>>>> > aries.transaction.timeout=1
>>>>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>>>>> > I set the logfile directory as well as the transaction timeout (I
>>>>> peeked at how they do it in Servicemix). I set the timeout to a low value
>>>>> in order to test that I actually get a transaction timeout. I also perform
>>>>> a 5s sleep in a transacted method to force a transaction timeout.
>>>>> > But, I never get a transaction timeout and I never get a transaction
>>>>> log file in the "logFileDir" directory. I'm not beginning to fear that my
>>>>> methods are not transacted. How can I verify this?
>>>>> > Under what circumstances would a transaction log file be created? I
>>>>> assumed that it would be created when the first transaction was created.
>>>>> Or, do I also need to add the following line?
>>>>> > aries.transaction.recoverable=true
>>>>> > I've tried that but still no logfile was created.
>>>>> > I also noticed that the default value for
>>>>> "aries.transaction.howl.maxBuffers" is 0 while the default value for
>>>>> "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
>>>>> would think it should be the other way around.
>>>>> > /Bengt
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>>>>> >
>>>>> > Thanks Alasdair - will look into it.
>>>>> > /Bengt
>>>>> >
>>>>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>>>>> >
>>>>> > Hi,
>>>>> > The pid for configuring transactions is
>>>>> "org.apache.aries.transaction".
>>>>> > Alasdair
>>>>> >
>>>>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>>>>> >
>>>>> > It turned out that my error was not due to the transaction timing
>>>>> out but to violation of unique constraints. Nevertheless, I would like to
>>>>> know how to control the transaction timeout in Aries transaction.
>>>>> > /Bengt
>>>>> >
>>>>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>>>>> >
>>>>> > Thanks for your reply David,
>>>>> > I'll see if I can figure out the pid although this seems like
>>>>> something that really needs to be documented in Aries. If the default
>>>>> timeout is 600 seconds then this is probably not the reason of the errors I
>>>>> see. I need a time out of about 30 s which then is much less than the
>>>>> default.
>>>>> > I have been using MySql but I'm in the process of switching to SQL
>>>>> Server 2005. MySql worked fine but I started having problems committing the
>>>>> longer transactions with SQL Server 2005 which caused me to suspect a
>>>>> transaction timeout. Perhaps the timeout is not propagated to SQL Server
>>>>> like you hinted.
>>>>> > /Bengt
>>>>> >
>>>>> > 2011/12/14 David Jencks <da...@yahoo.com>
>>>>> >
>>>>> > Transaction is set up as a managed service factory.  I haven't
>>>>> figured out exactly how this results in a tm instance without any visible
>>>>> configuration.
>>>>> > If you can figure out what is triggering the creation of a tm and
>>>>> the pid, the property to set is called aries.transaction.timeout and the
>>>>> default value is 600 (seconds) or 10 minutes.
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>

Re: How to configure transaction timeout?

Posted by David Jencks <da...@yahoo.com>.
I bet I know what's going on... setting the tx timeout only applies to that thread and the next transaction on that thread.  There's a default transaction timeout milliseconds that can only be set in the tm constructor.  This is not a suitable model for osgi configuration.

In my geronimo sandbox I refactored the tm so it has better osgi structure.  Maybe we should work to release that.  It would pretty much replace the aries tm.

david jencks

On Jan 13, 2012, at 7:34 AM, Bengt Rodehav wrote:

> I have now tested to sleep 650 s which exceeds the default transaction timeout of 600 s. This gives me an exception due to transaction timeout. Thus Geronimo transaction timeout works.
> 
> I then configure the transaction timeout to 30 s (in the manner I've described previously) and sleep for 60 s in order to force a transaction timeout. I don't get a transaction timeout.
> 
> To be sure I then checked to see if the configuration was bound and it wasn't! I had just made a fresh start of Karaf (by deleting the bundle cache). I also tried doing a refresh but the configuration was still unbound. I then restarted Karaf (without clearing the bundle cache) and after that the configuration was bound.
> 
> However, even after my configuration was bound the test I did still did not provoke a transaction timeout.
> 
> I think there must be something wrong with the way Aries transaction picks up its configuration - perhaps some timing issue.
> 
> Also, even when the configuration is bound, it still doesn't seem to affect the transaction manager. Perhaps the transaction manager is created to soon and then not recreated when configuration updates are pushed by config admin?
> 
> Can anyone explain this? Has anyone been able to configure the transaction manager at all?
> 
> /Bengt
> 
> 
> 2012/1/13 Bengt Rodehav <be...@rodehav.com>
> David,
> 
> That test is almost identical to what I did in my code. The difference is that I don't explicitly access the transaction manager like you do. I use blueprint to make my method transactional (with the "Requires" transaction attribute) and I configure the transaction timeout via Config Admin.
> 
> I never doubted that Geronimo's transaction timeout worked but I wonder if Aries is setting the properties correctly. I will make a test where I sleep for longer than the default timeout (600 s) to see if that would trigger an exception. If so, then the problem is how to configure the timeout correctly.
> 
> /Bengt
> 
> 2012/1/13 David Jencks <da...@yahoo.com>
> 
> On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:
> 
>> David, do you think I should create a JIRA for this? I don't know for sure whether I'm doing anything wrong or not but I think it makes sense to add an integration test for the transaction timeout anyway.
> 
> I looked and geronimo has a timeout test like this:
> 
>     public void testTimeout() throws Exception
>     {
>         long timeout = tm.getTransactionTimeoutMilliseconds(0L);
>         tm.setTransactionTimeout((int)timeout/4000);
>         tm.begin();
>         System.out.println("Test to sleep for " + timeout + " millisecs");
>         Thread.sleep(timeout);
>         try
>         {
>             tm.commit();
>             fail("Tx Should get Rollback exception");
>         }catch(RollbackException rex)
>         {
>             // Caught expected exception
>         }
> 
>         // Now test if the default timeout is active
>         tm.begin();
>         System.out.println("Test to sleep for " + (timeout/2) + " millisecs");
>         Thread.sleep((timeout/2));
>         tm.commit();
>         // Its a failure if exception occurs.
>     }    
> 
> 
> So I tend to think timeout works.  Is what's tested for here what you observe in your code?
> 
> thanks
> david jencks
>> 
>> I'm currently just using one resource manager (SQL Server 2005) which I guess means that no transaction log is necessary. Thanks for explaining.
>> 
>> /Bengt
>> 
>> 2012/1/13 David Jencks <da...@yahoo.com>
>> 
>> On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:
>> 
>>> I took a look at the transaction related itests and I can't see any tests regarding the transaction timeout - they seem to be focused on testing the transaction attributes. Could it be that the transaction timeout has never been tested?
>> 
>> probably not in aries since the tm implementation is from geronimo.  I did think there were some osgi tx timeout tests but I dont have access right now.
>> 
>>> 
>>> Regarding the transaction log I'm not sure how this is supposed to work - perhaps someone can enlighten me. Shouldn't every transaction be written to a transaction log file?
>> 
>> Every successfully prepared transaction with at least two participating resource managers will have a log record written for prepare and another written for commit.  Transaction with only one participant don't need logging.
>> 
>> thanks
>> david jencks
>> 
>>> 
>>> /Bengt
>>> 
>>> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>>> 
>>> David,
>>> 
>>> I have verified that the configuration is applied to the transaction service I just can't see that it has any effect. I guess I can start debugging but I was hoping to avoid that. Do you know if there are any integration tests that tests the transaction timeout?
>>> 
>>> /Bengt
>>> 
>>> 
>>> Den torsdagen den 12:e januari 2012 skrev David Jencks<da...@yahoo.com>:
>>> 
>>> > I would guess that perhaps your configuration is not actually getting supplied to the managed service?  If you are running in karaf you can use confiig:list to make sure config admin is aware of your config.  You might also want to debug the aries code and make sure that  the configuration is actually getting supplied to the service.
>>> > david jencks
>>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>>> >
>>> > Hello again Alasdair,
>>> > I finally got around to test configuration of Aries Transaction. I created the following configuration (using PID org.apache.aries.transaction):
>>> > aries.transaction.timeout=1
>>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>>> > I set the logfile directory as well as the transaction timeout (I peeked at how they do it in Servicemix). I set the timeout to a low value in order to test that I actually get a transaction timeout. I also perform a 5s sleep in a transacted method to force a transaction timeout.
>>> > But, I never get a transaction timeout and I never get a transaction log file in the "logFileDir" directory. I'm not beginning to fear that my methods are not transacted. How can I verify this?
>>> > Under what circumstances would a transaction log file be created? I assumed that it would be created when the first transaction was created. Or, do I also need to add the following line?
>>> > aries.transaction.recoverable=true
>>> > I've tried that but still no logfile was created.
>>> > I also noticed that the default value for "aries.transaction.howl.maxBuffers" is 0 while the default value for "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I would think it should be the other way around.
>>> > /Bengt
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>>> >
>>> > Thanks Alasdair - will look into it.
>>> > /Bengt
>>> >
>>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>>> >
>>> > Hi,
>>> > The pid for configuring transactions is "org.apache.aries.transaction".
>>> > Alasdair
>>> >
>>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>>> >
>>> > It turned out that my error was not due to the transaction timing out but to violation of unique constraints. Nevertheless, I would like to know how to control the transaction timeout in Aries transaction.
>>> > /Bengt
>>> >
>>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>>> >
>>> > Thanks for your reply David,
>>> > I'll see if I can figure out the pid although this seems like something that really needs to be documented in Aries. If the default timeout is 600 seconds then this is probably not the reason of the errors I see. I need a time out of about 30 s which then is much less than the default.
>>> > I have been using MySql but I'm in the process of switching to SQL Server 2005. MySql worked fine but I started having problems committing the longer transactions with SQL Server 2005 which caused me to suspect a transaction timeout. Perhaps the timeout is not propagated to SQL Server like you hinted.
>>> > /Bengt
>>> >
>>> > 2011/12/14 David Jencks <da...@yahoo.com>
>>> >
>>> > Transaction is set up as a managed service factory.  I haven't figured out exactly how this results in a tm instance without any visible configuration.
>>> > If you can figure out what is triggering the creation of a tm and the pid, the property to set is called aries.transaction.timeout and the default value is 600 (seconds) or 10 minutes.
>>> 
>> 
>> 
> 
> 
> 


Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
I have now tested to sleep 650 s which exceeds the default transaction
timeout of 600 s. This gives me an exception due to transaction timeout.
Thus Geronimo transaction timeout works.

I then configure the transaction timeout to 30 s (in the manner I've
described previously) and sleep for 60 s in order to force a transaction
timeout. I don't get a transaction timeout.

To be sure I then checked to see if the configuration was bound and it
wasn't! I had just made a fresh start of Karaf (by deleting the bundle
cache). I also tried doing a refresh but the configuration was still
unbound. I then restarted Karaf (without clearing the bundle cache) and
after that the configuration was bound.

However, even after my configuration was bound the test I did still did not
provoke a transaction timeout.

I think there must be something wrong with the way Aries transaction picks
up its configuration - perhaps some timing issue.

Also, even when the configuration is bound, it still doesn't seem to affect
the transaction manager. Perhaps the transaction manager is created to soon
and then not recreated when configuration updates are pushed by config
admin?

Can anyone explain this? Has anyone been able to configure the transaction
manager at all?

/Bengt


2012/1/13 Bengt Rodehav <be...@rodehav.com>

> David,
>
> That test is almost identical to what I did in my code. The difference is
> that I don't explicitly access the transaction manager like you do. I use
> blueprint to make my method transactional (with the "Requires" transaction
> attribute) and I configure the transaction timeout via Config Admin.
>
> I never doubted that Geronimo's transaction timeout worked but I wonder if
> Aries is setting the properties correctly. I will make a test where I sleep
> for longer than the default timeout (600 s) to see if that would trigger an
> exception. If so, then the problem is how to configure the timeout
> correctly.
>
> /Bengt
>
> 2012/1/13 David Jencks <da...@yahoo.com>
>
>>
>> On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:
>>
>> David, do you think I should create a JIRA for this? I don't know for
>> sure whether I'm doing anything wrong or not but I think it makes sense to
>> add an integration test for the transaction timeout anyway.
>>
>>
>> I looked and geronimo has a timeout test like this:
>>
>>     public void testTimeout() throws Exception
>>     {
>>         long timeout = tm.getTransactionTimeoutMilliseconds(0L);
>>         tm.setTransactionTimeout((int)timeout/4000);
>>         tm.begin();
>>         System.out.println("Test to sleep for " + timeout + " millisecs");
>>         Thread.sleep(timeout);
>>         try
>>         {
>>             tm.commit();
>>             fail("Tx Should get Rollback exception");
>>         }catch(RollbackException rex)
>>         {
>>             // Caught expected exception
>>         }
>>
>>         // Now test if the default timeout is active
>>         tm.begin();
>>         System.out.println("Test to sleep for " + (timeout/2) + "
>> millisecs");
>>         Thread.sleep((timeout/2));
>>         tm.commit();
>>         // Its a failure if exception occurs.
>>     }
>>
>>
>> So I tend to think timeout works.  Is what's tested for here what you
>> observe in your code?
>>
>> thanks
>> david jencks
>>
>>
>> I'm currently just using one resource manager (SQL Server 2005) which I
>> guess means that no transaction log is necessary. Thanks for explaining.
>>
>> /Bengt
>>
>> 2012/1/13 David Jencks <da...@yahoo.com>
>>
>>>
>>> On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:
>>>
>>> I took a look at the transaction related itests and I can't see any
>>> tests regarding the transaction timeout - they seem to be focused on
>>> testing the transaction attributes. Could it be that the transaction
>>> timeout has never been tested?
>>>
>>>
>>> probably not in aries since the tm implementation is from geronimo.  I
>>> did think there were some osgi tx timeout tests but I dont have access
>>> right now.
>>>
>>>
>>> Regarding the transaction log I'm not sure how this is supposed to work
>>> - perhaps someone can enlighten me. Shouldn't every transaction be written
>>> to a transaction log file?
>>>
>>>
>>> Every successfully prepared transaction with at least two participating
>>> resource managers will have a log record written for prepare and another
>>> written for commit.  Transaction with only one participant don't need
>>> logging.
>>>
>>> thanks
>>> david jencks
>>>
>>>
>>> /Bengt
>>>
>>> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>>>
>>>>
>>>> David,
>>>>
>>>> I have verified that the configuration is applied to the transaction
>>>> service I just can't see that it has any effect. I guess I can start
>>>> debugging but I was hoping to avoid that. Do you know if there are any
>>>> integration tests that tests the transaction timeout?
>>>>
>>>> /Bengt
>>>>
>>>>
>>>> Den torsdagen den 12:e januari 2012 skrev David Jencks<
>>>> david_jencks@yahoo.com>:
>>>>
>>>> > I would guess that perhaps your configuration is not actually getting
>>>> supplied to the managed service?  If you are running in karaf you can use
>>>> confiig:list to make sure config admin is aware of your config.  You might
>>>> also want to debug the aries code and make sure that  the configuration is
>>>> actually getting supplied to the service.
>>>> > david jencks
>>>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>>>> >
>>>> > Hello again Alasdair,
>>>> > I finally got around to test configuration of Aries Transaction. I
>>>> created the following configuration (using
>>>> PID org.apache.aries.transaction):
>>>> > aries.transaction.timeout=1
>>>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>>>> > I set the logfile directory as well as the transaction timeout (I
>>>> peeked at how they do it in Servicemix). I set the timeout to a low value
>>>> in order to test that I actually get a transaction timeout. I also perform
>>>> a 5s sleep in a transacted method to force a transaction timeout.
>>>> > But, I never get a transaction timeout and I never get a transaction
>>>> log file in the "logFileDir" directory. I'm not beginning to fear that my
>>>> methods are not transacted. How can I verify this?
>>>> > Under what circumstances would a transaction log file be created? I
>>>> assumed that it would be created when the first transaction was created.
>>>> Or, do I also need to add the following line?
>>>> > aries.transaction.recoverable=true
>>>> > I've tried that but still no logfile was created.
>>>> > I also noticed that the default value for
>>>> "aries.transaction.howl.maxBuffers" is 0 while the default value for
>>>> "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
>>>> would think it should be the other way around.
>>>> > /Bengt
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>>>> >
>>>> > Thanks Alasdair - will look into it.
>>>> > /Bengt
>>>> >
>>>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>>>> >
>>>> > Hi,
>>>> > The pid for configuring transactions is
>>>> "org.apache.aries.transaction".
>>>> > Alasdair
>>>> >
>>>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>>>> >
>>>> > It turned out that my error was not due to the transaction timing out
>>>> but to violation of unique constraints. Nevertheless, I would like to know
>>>> how to control the transaction timeout in Aries transaction.
>>>> > /Bengt
>>>> >
>>>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>>>> >
>>>> > Thanks for your reply David,
>>>> > I'll see if I can figure out the pid although this seems like
>>>> something that really needs to be documented in Aries. If the default
>>>> timeout is 600 seconds then this is probably not the reason of the errors I
>>>> see. I need a time out of about 30 s which then is much less than the
>>>> default.
>>>> > I have been using MySql but I'm in the process of switching to SQL
>>>> Server 2005. MySql worked fine but I started having problems committing the
>>>> longer transactions with SQL Server 2005 which caused me to suspect a
>>>> transaction timeout. Perhaps the timeout is not propagated to SQL Server
>>>> like you hinted.
>>>> > /Bengt
>>>> >
>>>> > 2011/12/14 David Jencks <da...@yahoo.com>
>>>> >
>>>> > Transaction is set up as a managed service factory.  I haven't
>>>> figured out exactly how this results in a tm instance without any visible
>>>> configuration.
>>>> > If you can figure out what is triggering the creation of a tm and the
>>>> pid, the property to set is called aries.transaction.timeout and the
>>>> default value is 600 (seconds) or 10 minutes.
>>>>
>>>
>>>
>>>
>>
>>
>

Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
David,

That test is almost identical to what I did in my code. The difference is
that I don't explicitly access the transaction manager like you do. I use
blueprint to make my method transactional (with the "Requires" transaction
attribute) and I configure the transaction timeout via Config Admin.

I never doubted that Geronimo's transaction timeout worked but I wonder if
Aries is setting the properties correctly. I will make a test where I sleep
for longer than the default timeout (600 s) to see if that would trigger an
exception. If so, then the problem is how to configure the timeout
correctly.

/Bengt

2012/1/13 David Jencks <da...@yahoo.com>

>
> On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:
>
> David, do you think I should create a JIRA for this? I don't know for sure
> whether I'm doing anything wrong or not but I think it makes sense to add
> an integration test for the transaction timeout anyway.
>
>
> I looked and geronimo has a timeout test like this:
>
>     public void testTimeout() throws Exception
>     {
>         long timeout = tm.getTransactionTimeoutMilliseconds(0L);
>         tm.setTransactionTimeout((int)timeout/4000);
>         tm.begin();
>         System.out.println("Test to sleep for " + timeout + " millisecs");
>         Thread.sleep(timeout);
>         try
>         {
>             tm.commit();
>             fail("Tx Should get Rollback exception");
>         }catch(RollbackException rex)
>         {
>             // Caught expected exception
>         }
>
>         // Now test if the default timeout is active
>         tm.begin();
>         System.out.println("Test to sleep for " + (timeout/2) + "
> millisecs");
>         Thread.sleep((timeout/2));
>         tm.commit();
>         // Its a failure if exception occurs.
>     }
>
>
> So I tend to think timeout works.  Is what's tested for here what you
> observe in your code?
>
> thanks
> david jencks
>
>
> I'm currently just using one resource manager (SQL Server 2005) which I
> guess means that no transaction log is necessary. Thanks for explaining.
>
> /Bengt
>
> 2012/1/13 David Jencks <da...@yahoo.com>
>
>>
>> On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:
>>
>> I took a look at the transaction related itests and I can't see any tests
>> regarding the transaction timeout - they seem to be focused on testing the
>> transaction attributes. Could it be that the transaction timeout has never
>> been tested?
>>
>>
>> probably not in aries since the tm implementation is from geronimo.  I
>> did think there were some osgi tx timeout tests but I dont have access
>> right now.
>>
>>
>> Regarding the transaction log I'm not sure how this is supposed to work -
>> perhaps someone can enlighten me. Shouldn't every transaction be written to
>> a transaction log file?
>>
>>
>> Every successfully prepared transaction with at least two participating
>> resource managers will have a log record written for prepare and another
>> written for commit.  Transaction with only one participant don't need
>> logging.
>>
>> thanks
>> david jencks
>>
>>
>> /Bengt
>>
>> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>>
>>>
>>> David,
>>>
>>> I have verified that the configuration is applied to the transaction
>>> service I just can't see that it has any effect. I guess I can start
>>> debugging but I was hoping to avoid that. Do you know if there are any
>>> integration tests that tests the transaction timeout?
>>>
>>> /Bengt
>>>
>>>
>>> Den torsdagen den 12:e januari 2012 skrev David Jencks<
>>> david_jencks@yahoo.com>:
>>>
>>> > I would guess that perhaps your configuration is not actually getting
>>> supplied to the managed service?  If you are running in karaf you can use
>>> confiig:list to make sure config admin is aware of your config.  You might
>>> also want to debug the aries code and make sure that  the configuration is
>>> actually getting supplied to the service.
>>> > david jencks
>>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>>> >
>>> > Hello again Alasdair,
>>> > I finally got around to test configuration of Aries Transaction. I
>>> created the following configuration (using
>>> PID org.apache.aries.transaction):
>>> > aries.transaction.timeout=1
>>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>>> > I set the logfile directory as well as the transaction timeout (I
>>> peeked at how they do it in Servicemix). I set the timeout to a low value
>>> in order to test that I actually get a transaction timeout. I also perform
>>> a 5s sleep in a transacted method to force a transaction timeout.
>>> > But, I never get a transaction timeout and I never get a transaction
>>> log file in the "logFileDir" directory. I'm not beginning to fear that my
>>> methods are not transacted. How can I verify this?
>>> > Under what circumstances would a transaction log file be created? I
>>> assumed that it would be created when the first transaction was created.
>>> Or, do I also need to add the following line?
>>> > aries.transaction.recoverable=true
>>> > I've tried that but still no logfile was created.
>>> > I also noticed that the default value for
>>> "aries.transaction.howl.maxBuffers" is 0 while the default value for
>>> "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
>>> would think it should be the other way around.
>>> > /Bengt
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>>> >
>>> > Thanks Alasdair - will look into it.
>>> > /Bengt
>>> >
>>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>>> >
>>> > Hi,
>>> > The pid for configuring transactions is "org.apache.aries.transaction".
>>> > Alasdair
>>> >
>>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>>> >
>>> > It turned out that my error was not due to the transaction timing out
>>> but to violation of unique constraints. Nevertheless, I would like to know
>>> how to control the transaction timeout in Aries transaction.
>>> > /Bengt
>>> >
>>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>>> >
>>> > Thanks for your reply David,
>>> > I'll see if I can figure out the pid although this seems like
>>> something that really needs to be documented in Aries. If the default
>>> timeout is 600 seconds then this is probably not the reason of the errors I
>>> see. I need a time out of about 30 s which then is much less than the
>>> default.
>>> > I have been using MySql but I'm in the process of switching to SQL
>>> Server 2005. MySql worked fine but I started having problems committing the
>>> longer transactions with SQL Server 2005 which caused me to suspect a
>>> transaction timeout. Perhaps the timeout is not propagated to SQL Server
>>> like you hinted.
>>> > /Bengt
>>> >
>>> > 2011/12/14 David Jencks <da...@yahoo.com>
>>> >
>>> > Transaction is set up as a managed service factory.  I haven't figured
>>> out exactly how this results in a tm instance without any visible
>>> configuration.
>>> > If you can figure out what is triggering the creation of a tm and the
>>> pid, the property to set is called aries.transaction.timeout and the
>>> default value is 600 (seconds) or 10 minutes.
>>>
>>
>>
>>
>
>

Re: How to configure transaction timeout?

Posted by David Jencks <da...@yahoo.com>.
On Jan 12, 2012, at 11:08 PM, Bengt Rodehav wrote:

> David, do you think I should create a JIRA for this? I don't know for sure whether I'm doing anything wrong or not but I think it makes sense to add an integration test for the transaction timeout anyway.

I looked and geronimo has a timeout test like this:

    public void testTimeout() throws Exception
    {
        long timeout = tm.getTransactionTimeoutMilliseconds(0L);
        tm.setTransactionTimeout((int)timeout/4000);
        tm.begin();
        System.out.println("Test to sleep for " + timeout + " millisecs");
        Thread.sleep(timeout);
        try
        {
            tm.commit();
            fail("Tx Should get Rollback exception");
        }catch(RollbackException rex)
        {
            // Caught expected exception
        }

        // Now test if the default timeout is active
        tm.begin();
        System.out.println("Test to sleep for " + (timeout/2) + " millisecs");
        Thread.sleep((timeout/2));
        tm.commit();
        // Its a failure if exception occurs.
    }    


So I tend to think timeout works.  Is what's tested for here what you observe in your code?

thanks
david jencks
> 
> I'm currently just using one resource manager (SQL Server 2005) which I guess means that no transaction log is necessary. Thanks for explaining.
> 
> /Bengt
> 
> 2012/1/13 David Jencks <da...@yahoo.com>
> 
> On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:
> 
>> I took a look at the transaction related itests and I can't see any tests regarding the transaction timeout - they seem to be focused on testing the transaction attributes. Could it be that the transaction timeout has never been tested?
> 
> probably not in aries since the tm implementation is from geronimo.  I did think there were some osgi tx timeout tests but I dont have access right now.
> 
>> 
>> Regarding the transaction log I'm not sure how this is supposed to work - perhaps someone can enlighten me. Shouldn't every transaction be written to a transaction log file?
> 
> Every successfully prepared transaction with at least two participating resource managers will have a log record written for prepare and another written for commit.  Transaction with only one participant don't need logging.
> 
> thanks
> david jencks
> 
>> 
>> /Bengt
>> 
>> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>> 
>> David,
>> 
>> I have verified that the configuration is applied to the transaction service I just can't see that it has any effect. I guess I can start debugging but I was hoping to avoid that. Do you know if there are any integration tests that tests the transaction timeout?
>> 
>> /Bengt
>> 
>> 
>> Den torsdagen den 12:e januari 2012 skrev David Jencks<da...@yahoo.com>:
>> 
>> > I would guess that perhaps your configuration is not actually getting supplied to the managed service?  If you are running in karaf you can use confiig:list to make sure config admin is aware of your config.  You might also want to debug the aries code and make sure that  the configuration is actually getting supplied to the service.
>> > david jencks
>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>> >
>> > Hello again Alasdair,
>> > I finally got around to test configuration of Aries Transaction. I created the following configuration (using PID org.apache.aries.transaction):
>> > aries.transaction.timeout=1
>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>> > I set the logfile directory as well as the transaction timeout (I peeked at how they do it in Servicemix). I set the timeout to a low value in order to test that I actually get a transaction timeout. I also perform a 5s sleep in a transacted method to force a transaction timeout.
>> > But, I never get a transaction timeout and I never get a transaction log file in the "logFileDir" directory. I'm not beginning to fear that my methods are not transacted. How can I verify this?
>> > Under what circumstances would a transaction log file be created? I assumed that it would be created when the first transaction was created. Or, do I also need to add the following line?
>> > aries.transaction.recoverable=true
>> > I've tried that but still no logfile was created.
>> > I also noticed that the default value for "aries.transaction.howl.maxBuffers" is 0 while the default value for "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I would think it should be the other way around.
>> > /Bengt
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>> >
>> > Thanks Alasdair - will look into it.
>> > /Bengt
>> >
>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>> >
>> > Hi,
>> > The pid for configuring transactions is "org.apache.aries.transaction".
>> > Alasdair
>> >
>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>> >
>> > It turned out that my error was not due to the transaction timing out but to violation of unique constraints. Nevertheless, I would like to know how to control the transaction timeout in Aries transaction.
>> > /Bengt
>> >
>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>> >
>> > Thanks for your reply David,
>> > I'll see if I can figure out the pid although this seems like something that really needs to be documented in Aries. If the default timeout is 600 seconds then this is probably not the reason of the errors I see. I need a time out of about 30 s which then is much less than the default.
>> > I have been using MySql but I'm in the process of switching to SQL Server 2005. MySql worked fine but I started having problems committing the longer transactions with SQL Server 2005 which caused me to suspect a transaction timeout. Perhaps the timeout is not propagated to SQL Server like you hinted.
>> > /Bengt
>> >
>> > 2011/12/14 David Jencks <da...@yahoo.com>
>> >
>> > Transaction is set up as a managed service factory.  I haven't figured out exactly how this results in a tm instance without any visible configuration.
>> > If you can figure out what is triggering the creation of a tm and the pid, the property to set is called aries.transaction.timeout and the default value is 600 (seconds) or 10 minutes.
>> 
> 
> 


Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
David, do you think I should create a JIRA for this? I don't know for sure
whether I'm doing anything wrong or not but I think it makes sense to add
an integration test for the transaction timeout anyway.

I'm currently just using one resource manager (SQL Server 2005) which I
guess means that no transaction log is necessary. Thanks for explaining.

/Bengt

2012/1/13 David Jencks <da...@yahoo.com>

>
> On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:
>
> I took a look at the transaction related itests and I can't see any tests
> regarding the transaction timeout - they seem to be focused on testing the
> transaction attributes. Could it be that the transaction timeout has never
> been tested?
>
>
> probably not in aries since the tm implementation is from geronimo.  I did
> think there were some osgi tx timeout tests but I dont have access right
> now.
>
>
> Regarding the transaction log I'm not sure how this is supposed to work -
> perhaps someone can enlighten me. Shouldn't every transaction be written to
> a transaction log file?
>
>
> Every successfully prepared transaction with at least two participating
> resource managers will have a log record written for prepare and another
> written for commit.  Transaction with only one participant don't need
> logging.
>
> thanks
> david jencks
>
>
> /Bengt
>
> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
>
>>
>> David,
>>
>> I have verified that the configuration is applied to the transaction
>> service I just can't see that it has any effect. I guess I can start
>> debugging but I was hoping to avoid that. Do you know if there are any
>> integration tests that tests the transaction timeout?
>>
>> /Bengt
>>
>>
>> Den torsdagen den 12:e januari 2012 skrev David Jencks<
>> david_jencks@yahoo.com>:
>>
>> > I would guess that perhaps your configuration is not actually getting
>> supplied to the managed service?  If you are running in karaf you can use
>> confiig:list to make sure config admin is aware of your config.  You might
>> also want to debug the aries code and make sure that  the configuration is
>> actually getting supplied to the service.
>> > david jencks
>> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>> >
>> > Hello again Alasdair,
>> > I finally got around to test configuration of Aries Transaction. I
>> created the following configuration (using
>> PID org.apache.aries.transaction):
>> > aries.transaction.timeout=1
>> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
>> > I set the logfile directory as well as the transaction timeout (I
>> peeked at how they do it in Servicemix). I set the timeout to a low value
>> in order to test that I actually get a transaction timeout. I also perform
>> a 5s sleep in a transacted method to force a transaction timeout.
>> > But, I never get a transaction timeout and I never get a transaction
>> log file in the "logFileDir" directory. I'm not beginning to fear that my
>> methods are not transacted. How can I verify this?
>> > Under what circumstances would a transaction log file be created? I
>> assumed that it would be created when the first transaction was created.
>> Or, do I also need to add the following line?
>> > aries.transaction.recoverable=true
>> > I've tried that but still no logfile was created.
>> > I also noticed that the default value for
>> "aries.transaction.howl.maxBuffers" is 0 while the default value for
>> "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
>> would think it should be the other way around.
>> > /Bengt
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>> >
>> > Thanks Alasdair - will look into it.
>> > /Bengt
>> >
>> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
>> >
>> > Hi,
>> > The pid for configuring transactions is "org.apache.aries.transaction".
>> > Alasdair
>> >
>> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>> >
>> > It turned out that my error was not due to the transaction timing out
>> but to violation of unique constraints. Nevertheless, I would like to know
>> how to control the transaction timeout in Aries transaction.
>> > /Bengt
>> >
>> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>> >
>> > Thanks for your reply David,
>> > I'll see if I can figure out the pid although this seems like something
>> that really needs to be documented in Aries. If the default timeout is 600
>> seconds then this is probably not the reason of the errors I see. I need a
>> time out of about 30 s which then is much less than the default.
>> > I have been using MySql but I'm in the process of switching to SQL
>> Server 2005. MySql worked fine but I started having problems committing the
>> longer transactions with SQL Server 2005 which caused me to suspect a
>> transaction timeout. Perhaps the timeout is not propagated to SQL Server
>> like you hinted.
>> > /Bengt
>> >
>> > 2011/12/14 David Jencks <da...@yahoo.com>
>> >
>> > Transaction is set up as a managed service factory.  I haven't figured
>> out exactly how this results in a tm instance without any visible
>> configuration.
>> > If you can figure out what is triggering the creation of a tm and the
>> pid, the property to set is called aries.transaction.timeout and the
>> default value is 600 (seconds) or 10 minutes.
>>
>
>
>

Re: How to configure transaction timeout?

Posted by David Jencks <da...@yahoo.com>.
On Jan 12, 2012, at 1:26 PM, Bengt Rodehav wrote:

> I took a look at the transaction related itests and I can't see any tests regarding the transaction timeout - they seem to be focused on testing the transaction attributes. Could it be that the transaction timeout has never been tested?

probably not in aries since the tm implementation is from geronimo.  I did think there were some osgi tx timeout tests but I dont have access right now.
> 
> Regarding the transaction log I'm not sure how this is supposed to work - perhaps someone can enlighten me. Shouldn't every transaction be written to a transaction log file?

Every successfully prepared transaction with at least two participating resource managers will have a log record written for prepare and another written for commit.  Transaction with only one participant don't need logging.

thanks
david jencks

> 
> /Bengt
> 
> 2012/1/12 Bengt Rodehav <be...@rodehav.com>
> 
> David,
> 
> I have verified that the configuration is applied to the transaction service I just can't see that it has any effect. I guess I can start debugging but I was hoping to avoid that. Do you know if there are any integration tests that tests the transaction timeout?
> 
> /Bengt
> 
> 
> Den torsdagen den 12:e januari 2012 skrev David Jencks<da...@yahoo.com>:
> 
> > I would guess that perhaps your configuration is not actually getting supplied to the managed service?  If you are running in karaf you can use confiig:list to make sure config admin is aware of your config.  You might also want to debug the aries code and make sure that  the configuration is actually getting supplied to the service.
> > david jencks
> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
> >
> > Hello again Alasdair,
> > I finally got around to test configuration of Aries Transaction. I created the following configuration (using PID org.apache.aries.transaction):
> > aries.transaction.timeout=1
> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
> > I set the logfile directory as well as the transaction timeout (I peeked at how they do it in Servicemix). I set the timeout to a low value in order to test that I actually get a transaction timeout. I also perform a 5s sleep in a transacted method to force a transaction timeout.
> > But, I never get a transaction timeout and I never get a transaction log file in the "logFileDir" directory. I'm not beginning to fear that my methods are not transacted. How can I verify this?
> > Under what circumstances would a transaction log file be created? I assumed that it would be created when the first transaction was created. Or, do I also need to add the following line?
> > aries.transaction.recoverable=true
> > I've tried that but still no logfile was created.
> > I also noticed that the default value for "aries.transaction.howl.maxBuffers" is 0 while the default value for "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I would think it should be the other way around.
> > /Bengt
> >
> >
> >
> >
> >
> >
> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
> >
> > Thanks Alasdair - will look into it.
> > /Bengt
> >
> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
> >
> > Hi,
> > The pid for configuring transactions is "org.apache.aries.transaction".
> > Alasdair
> >
> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
> >
> > It turned out that my error was not due to the transaction timing out but to violation of unique constraints. Nevertheless, I would like to know how to control the transaction timeout in Aries transaction.
> > /Bengt
> >
> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
> >
> > Thanks for your reply David,
> > I'll see if I can figure out the pid although this seems like something that really needs to be documented in Aries. If the default timeout is 600 seconds then this is probably not the reason of the errors I see. I need a time out of about 30 s which then is much less than the default.
> > I have been using MySql but I'm in the process of switching to SQL Server 2005. MySql worked fine but I started having problems committing the longer transactions with SQL Server 2005 which caused me to suspect a transaction timeout. Perhaps the timeout is not propagated to SQL Server like you hinted.
> > /Bengt
> >
> > 2011/12/14 David Jencks <da...@yahoo.com>
> >
> > Transaction is set up as a managed service factory.  I haven't figured out exactly how this results in a tm instance without any visible configuration.
> > If you can figure out what is triggering the creation of a tm and the pid, the property to set is called aries.transaction.timeout and the default value is 600 (seconds) or 10 minutes.
> 


Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
I took a look at the transaction related itests and I can't see any tests
regarding the transaction timeout - they seem to be focused on testing the
transaction attributes. Could it be that the transaction timeout has never
been tested?

Regarding the transaction log I'm not sure how this is supposed to work -
perhaps someone can enlighten me. Shouldn't every transaction be written to
a transaction log file?

/Bengt

2012/1/12 Bengt Rodehav <be...@rodehav.com>

>
> David,
>
> I have verified that the configuration is applied to the transaction
> service I just can't see that it has any effect. I guess I can start
> debugging but I was hoping to avoid that. Do you know if there are any
> integration tests that tests the transaction timeout?
>
> /Bengt
>
>
> Den torsdagen den 12:e januari 2012 skrev David Jencks<
> david_jencks@yahoo.com>:
>
> > I would guess that perhaps your configuration is not actually getting
> supplied to the managed service?  If you are running in karaf you can use
> confiig:list to make sure config admin is aware of your config.  You might
> also want to debug the aries code and make sure that  the configuration is
> actually getting supplied to the service.
> > david jencks
> > On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
> >
> > Hello again Alasdair,
> > I finally got around to test configuration of Aries Transaction. I
> created the following configuration (using
> PID org.apache.aries.transaction):
> > aries.transaction.timeout=1
> > aries.transaction.howl.logFileDir=${karaf.data}/txlog/
> > I set the logfile directory as well as the transaction timeout (I peeked
> at how they do it in Servicemix). I set the timeout to a low value in order
> to test that I actually get a transaction timeout. I also perform a 5s
> sleep in a transacted method to force a transaction timeout.
> > But, I never get a transaction timeout and I never get a transaction log
> file in the "logFileDir" directory. I'm not beginning to fear that my
> methods are not transacted. How can I verify this?
> > Under what circumstances would a transaction log file be created? I
> assumed that it would be created when the first transaction was created.
> Or, do I also need to add the following line?
> > aries.transaction.recoverable=true
> > I've tried that but still no logfile was created.
> > I also noticed that the default value for
> "aries.transaction.howl.maxBuffers" is 0 while the default value for
> "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
> would think it should be the other way around.
> > /Bengt
> >
> >
> >
> >
> >
> >
> > 2011/12/29 Bengt Rodehav <be...@rodehav.com>
> >
> > Thanks Alasdair - will look into it.
> > /Bengt
> >
> > 2011/12/28 Alasdair Nottingham <no...@apache.org>
> >
> > Hi,
> > The pid for configuring transactions is "org.apache.aries.transaction".
> > Alasdair
> >
> > On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
> >
> > It turned out that my error was not due to the transaction timing out
> but to violation of unique constraints. Nevertheless, I would like to know
> how to control the transaction timeout in Aries transaction.
> > /Bengt
> >
> > 2011/12/14 Bengt Rodehav <be...@rodehav.com>
> >
> > Thanks for your reply David,
> > I'll see if I can figure out the pid although this seems like something
> that really needs to be documented in Aries. If the default timeout is 600
> seconds then this is probably not the reason of the errors I see. I need a
> time out of about 30 s which then is much less than the default.
> > I have been using MySql but I'm in the process of switching to SQL
> Server 2005. MySql worked fine but I started having problems committing the
> longer transactions with SQL Server 2005 which caused me to suspect a
> transaction timeout. Perhaps the timeout is not propagated to SQL Server
> like you hinted.
> > /Bengt
> >
> > 2011/12/14 David Jencks <da...@yahoo.com>
> >
> > Transaction is set up as a managed service factory.  I haven't figured
> out exactly how this results in a tm instance without any visible
> configuration.
> > If you can figure out what is triggering the creation of a tm and the
> pid, the property to set is called aries.transaction.timeout and the
> default value is 600 (seconds) or 10 minutes.
>

Re: How to configure transaction timeout?

Posted by Bengt Rodehav <be...@rodehav.com>.
David,

I have verified that the configuration is applied to the transaction
service I just can't see that it has any effect. I guess I can start
debugging but I was hoping to avoid that. Do you know if there are any
integration tests that tests the transaction timeout?

/Bengt


Den torsdagen den 12:e januari 2012 skrev David Jencks<
david_jencks@yahoo.com>:
> I would guess that perhaps your configuration is not actually getting
supplied to the managed service?  If you are running in karaf you can use
confiig:list to make sure config admin is aware of your config.  You might
also want to debug the aries code and make sure that  the configuration is
actually getting supplied to the service.
> david jencks
> On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:
>
> Hello again Alasdair,
> I finally got around to test configuration of Aries Transaction. I
created the following configuration (using
PID org.apache.aries.transaction):
> aries.transaction.timeout=1
> aries.transaction.howl.logFileDir=${karaf.data}/txlog/
> I set the logfile directory as well as the transaction timeout (I peeked
at how they do it in Servicemix). I set the timeout to a low value in order
to test that I actually get a transaction timeout. I also perform a 5s
sleep in a transacted method to force a transaction timeout.
> But, I never get a transaction timeout and I never get a transaction log
file in the "logFileDir" directory. I'm not beginning to fear that my
methods are not transacted. How can I verify this?
> Under what circumstances would a transaction log file be created? I
assumed that it would be created when the first transaction was created.
Or, do I also need to add the following line?
> aries.transaction.recoverable=true
> I've tried that but still no logfile was created.
> I also noticed that the default value for
"aries.transaction.howl.maxBuffers" is 0 while the default value for
"aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I
would think it should be the other way around.
> /Bengt
>
>
>
>
>
>
> 2011/12/29 Bengt Rodehav <be...@rodehav.com>
>
> Thanks Alasdair - will look into it.
> /Bengt
>
> 2011/12/28 Alasdair Nottingham <no...@apache.org>
>
> Hi,
> The pid for configuring transactions is "org.apache.aries.transaction".
> Alasdair
>
> On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
>
> It turned out that my error was not due to the transaction timing out but
to violation of unique constraints. Nevertheless, I would like to know how
to control the transaction timeout in Aries transaction.
> /Bengt
>
> 2011/12/14 Bengt Rodehav <be...@rodehav.com>
>
> Thanks for your reply David,
> I'll see if I can figure out the pid although this seems like something
that really needs to be documented in Aries. If the default timeout is 600
seconds then this is probably not the reason of the errors I see. I need a
time out of about 30 s which then is much less than the default.
> I have been using MySql but I'm in the process of switching to SQL Server
2005. MySql worked fine but I started having problems committing the longer
transactions with SQL Server 2005 which caused me to suspect a transaction
timeout. Perhaps the timeout is not propagated to SQL Server like you
hinted.
> /Bengt
>
> 2011/12/14 David Jencks <da...@yahoo.com>
>
> Transaction is set up as a managed service factory.  I haven't figured
out exactly how this results in a tm instance without any visible
configuration.
> If you can figure out what is triggering the creation of a tm and the
pid, the property to set is called aries.transaction.timeout and the
default value is 600 (seconds) or 10 minutes.

Re: How to configure transaction timeout?

Posted by David Jencks <da...@yahoo.com>.
I would guess that perhaps your configuration is not actually getting supplied to the managed service?  If you are running in karaf you can use confiig:list to make sure config admin is aware of your config.  You might also want to debug the aries code and make sure that  the configuration is actually getting supplied to the service.

david jencks

On Jan 12, 2012, at 6:36 AM, Bengt Rodehav wrote:

> Hello again Alasdair,
> 
> I finally got around to test configuration of Aries Transaction. I created the following configuration (using PID org.apache.aries.transaction):
> 
> aries.transaction.timeout=1
> aries.transaction.howl.logFileDir=${karaf.data}/txlog/
> 
> I set the logfile directory as well as the transaction timeout (I peeked at how they do it in Servicemix). I set the timeout to a low value in order to test that I actually get a transaction timeout. I also perform a 5s sleep in a transacted method to force a transaction timeout.
> 
> But, I never get a transaction timeout and I never get a transaction log file in the "logFileDir" directory. I'm not beginning to fear that my methods are not transacted. How can I verify this?
> 
> Under what circumstances would a transaction log file be created? I assumed that it would be created when the first transaction was created. Or, do I also need to add the following line?
> 
> aries.transaction.recoverable=true
> 
> I've tried that but still no logfile was created.
> 
> I also noticed that the default value for "aries.transaction.howl.maxBuffers" is 0 while the default value for "aries.transaction.howl.minBuffers" is 4. Is that correct? At first sight I would think it should be the other way around.
> 
> /Bengt
> 
> 
> 
> 
> 
> 
> 
> 2011/12/29 Bengt Rodehav <be...@rodehav.com>
> Thanks Alasdair - will look into it.
> 
> /Bengt
> 
> 
> 2011/12/28 Alasdair Nottingham <no...@apache.org>
> Hi,
> 
> The pid for configuring transactions is "org.apache.aries.transaction".
> 
> Alasdair
> 
> 
> On 14 December 2011 14:33, Bengt Rodehav <be...@rodehav.com> wrote:
> It turned out that my error was not due to the transaction timing out but to violation of unique constraints. Nevertheless, I would like to know how to control the transaction timeout in Aries transaction.
> 
> /Bengt
> 
> 
> 2011/12/14 Bengt Rodehav <be...@rodehav.com>
> Thanks for your reply David,
> 
> I'll see if I can figure out the pid although this seems like something that really needs to be documented in Aries. If the default timeout is 600 seconds then this is probably not the reason of the errors I see. I need a time out of about 30 s which then is much less than the default.
> 
> I have been using MySql but I'm in the process of switching to SQL Server 2005. MySql worked fine but I started having problems committing the longer transactions with SQL Server 2005 which caused me to suspect a transaction timeout. Perhaps the timeout is not propagated to SQL Server like you hinted.
> 
> /Bengt
> 
> 
> 2011/12/14 David Jencks <da...@yahoo.com>
> Transaction is set up as a managed service factory.  I haven't figured out exactly how this results in a tm instance without any visible configuration.
> 
> If you can figure out what is triggering the creation of a tm and the pid, the property to set is called aries.transaction.timeout and the default value is 600 (seconds) or 10 minutes.
> 
> If you thing some of the resource managers might be timing out earlier, let me know.  I'm not sure we are propagating the tm timeout to the resource managers in each transaction.
> 
> thanks
> david jencks
> 
> On Dec 13, 2011, at 2:10 PM, Bengt Rodehav wrote:
> 
>> I use Aries JPA and Aries Transaction with OpenJpa. I have problems with some long transactions that time out (I think anyway). I cannot see where I can configure the transaction timeout for Aries Transaction. The only interaction I have with Aries Transaction is my blueprint definition where I create beans with transaction properties set and publish them as services. Below is an example of one of my blueprint definitions.
>> 
>> Can anyone advice me as to how one can configure the transacation timeout? (and what is the default?)
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
>>   xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0">
>> 
>>   <bean id="statementService" class="se.digia.skistory.domain.impl.StatementService">
>>     <tx:transaction method="*" value="Required" />
>>     <jpa:context property="entityManager" unitname="skistPU" />
>>   </bean>
>> 
>>   <service ref="statementService" interface="se.digia.skistory.domain.api.IStatementService">
>>   </service>
>> 
>>   <bean id="customerService" class="se.digia.skistory.domain.impl.CustomerService">
>>     <tx:transaction method="*" value="Required" />
>>     <jpa:context property="entityManager" unitname="skistPU" />
>>   </bean>
>> 
>>   <service ref="customerService" interface="se.digia.skistory.domain.api.ICustomerService">
>>   </service>
>> 
>> </blueprint>
>> 
>> /Bengt
> 
> 
> 
> 
> 
> 
> -- 
> Alasdair Nottingham
> not@apache.org
> 
>