flume-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Jones <andrewjone...@gmail.com>
Subject Custom sink - "close() called when transaction is OPEN" error
Date Wed, 14 Nov 2012 16:55:11 GMT

I have a custom sink which has been working fine, but recently I have
started seeing this error in the logs:

Unable to deliver event. Exception follows.
java.lang.IllegalStateException: close() called when transaction is OPEN -
you must either commit or rollback first

After having a google and finding
https://issues.apache.org/jira/browse/FLUME-1089, I have double checked I
am using the correct try, catch, finally idiom that other sinks use, and I
seem to be doing the same. I do the following:

public Status process() throws EventDeliveryException {
Status status = Status.READY;

Channel channel = getChannel();
 Transaction transaction = channel.getTransaction();

try {

                        // does a bit of processing and
                        // writes out the event to MongoDB


} catch (Throwable t) {

if (t instanceof Error) {
 throw (Error) t;
} else if  (t instanceof EventDeliveryException) {
throw (EventDeliveryException) t;
 } else if (t instanceof ChannelException) {
logger.error("Brodie Log Sink " + getName() + ": Unable to get event from" +
 " channel " + channel.getName() + ". Exception follows.", t);
status = Status.BACKOFF;
 } else {
throw new EventDeliveryException("Failed to send events", t);
 } finally {

return status;


All of this code came from looking at other sinks (Avro and HDFS), so I am
pretty sure its correct.

Can anyone see anything that might be a problem, or is there anything else
I can do to avoid this error?


View raw message