Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Flume >> mail # user >> Custom sink - "close() called when transaction is OPEN" error

Copy link to this message
Re: Custom sink - "close() called when transaction is OPEN" error
I tried logging the first throwable, but now that is just the

Today I have been looking at Flume-1.3.0rc3 and I have noticed the same
problem. This is using the Avro source, File channel and our custom sink.
After Flume reloads its config, the first error message comes when the Avro
source starts up:

16 Nov 2012 16:04:25,237 INFO  [lifecycleSupervisor-1-4]
(org.apache.flume.source.AvroSource.start:142)  - Starting Avro source
source: { bindAddress:, port: 36060 }...
16 Nov 2012 16:04:25,484 ERROR
(org.apache.flume.SinkRunner$PollingRunner.run:160)  - Unable to deliver
event. Exception follows.
java.lang.IllegalStateException: close() called when transaction is OPEN -
you must either commit or rollback first
        at java.lang.Thread.run(Thread.java:636)
16 Nov 2012 16:04:25,594 INFO  [lifecycleSupervisor-1-4]
(org.apache.flume.instrumentation.MonitoredCounterGroup.register:89)  -
Monitoried counter group for type: SOURCE, name: source, registered
16 Nov 2012 16:04:25,595 INFO  [lifecycleSupervisor-1-4]
(org.apache.flume.instrumentation.MonitoredCounterGroup.start:73)  -
Component type: SOURCE, name: source started
16 Nov 2012 16:04:25,595 INFO  [lifecycleSupervisor-1-4]
(org.apache.flume.source.AvroSource.start:168)  - Avro source source

I then continually get errors from the Sink, presumably as its been called
periodically to check for events in the channel. So is it possible its the
Avro source causing the issue?

There should have been nothing persisted in the file channel when

When the transaction gets messed up like this, is there a way to refresh
it, preferably without losing any data?

I am still able to send things to flume and they get processed and inserted
by my sink, so it still seems to work OK.


On 15 November 2012 12:50, Brock Noland <[EMAIL PROTECTED]> wrote:

> Can you log the Throwable as the first thing in the catch block to see
> if something and what it is, is being thrown?
> Transactions are thread local so if for some reason the the sequencing
> gets messed up on an earlier call the process, every call to
> transaction will thrown an exception including begin.
> https://github.com/apache/flume/blob/trunk/flume-ng-core/src/main/java/org/apache/flume/channel/BasicTransactionSemantics.java
> As I stated in FLUME-1089 I think that when close is called it should
> forcefully destroy the transaction like JDBC close() but I have not
> got much agreement.
> On Thu, Nov 15, 2012 at 5:24 AM, Andrew Jones <[EMAIL PROTECTED]>
> wrote:
> > We are using Flume 1.2.0. We have a custom source, although it passes
> > through an Avro Sink and Source before getting to the sink. We are now
> using
> > the memory channel, although had just switched from the JDBC channel
> when we
> > started seeing these errors, so maybe that's something to do with it?
> >
> > I tried wrapping transaction.rollback(); in a try catch and logging in
> the
> > catch, but it wasn't called, so I don't think the rollback is throwing an
> > error.
> >
> > I think it may have something to do with switching channels, as right
> after
> > Flume reloaded the config we started getting errors. I have restarted the
> > flume node manually and we are still getting the error.
> >
> > Thanks,
> > Andrew
> >
> >
> > On 14 November 2012 20:02, Hari Shreedharan <[EMAIL PROTECTED]>
> > wrote: