Emailing Reports using ACRA(ver 5.7.0) on Android not working - acra

Im trying to capture the crash logs and send it via mail using ACRA. But the mail is not received.
I have done the following :
1. Initialized ACRA inside the oncreate method of the main activity
ACRA.init(getApplication());
2. Specified the Report content
#AcraCore(reportContent = {
ReportField.REPORT_ID,
ReportField.USER_APP_START_DATE,
ReportField.USER_CRASH_DATE,
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.DEVICE_ID,
ReportField.BRAND,
ReportField.BUILD,
ReportField.DEVICE_FEATURES,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.STACK_TRACE,
ReportField.APPLICATION_LOG,
ReportField.LOGCAT,
ReportField.USER_EMAIL
},
reportFormat = JSON,
reportSenderFactoryClasses = {MainActivity.ACRASenderFactory.class}
)
3. Acrareportsender class below
public class ACRAReportSender implements ReportSender {
public ACRAReportSender(){
Log.e("ACRA", "Report Sender created");
}
#Override
public void send(Context context, CrashReportData crashReportData) throws ReportSenderException {
Log.e("ACRA", "Before sending crash report");
String reportBody = createCrashReport(crashReportData);
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("vnd.android.cursor.dir/email");
String mail[] = {"brajesh.poovakkad#gmail.com"};
emailIntent.putExtra(Intent.EXTRA_EMAIL, mail);
emailIntent.putExtra(Intent.EXTRA_TEXT, reportBody);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "ACRA Crash Report");
context.startActivity(Intent.createChooser(emailIntent, "Send crash to developers by email ..."));
}
public String createCrashReport(CrashReportData crashReportData){
StringBuilder body = new StringBuilder();
body.append("Device : " + crashReportData.getString(ReportField.BRAND) + " - " + crashReportData.getString(ReportField.PHONE_MODEL))
.append("\n")
.append("Android Version : " + crashReportData.getString(ReportField.ANDROID_VERSION))
.append("\n")
.append("App Version : " + crashReportData.getString(ReportField.APP_VERSION_CODE))
.append("\n")
.append("STACK TRACE : \n" + crashReportData.getString(ReportField.STACK_TRACE));
return body.toString();
}
}
4. AcraSenderFactory Class
public class ACRASenderFactory implements ReportSenderFactory {
public ACRASenderFactory(){
Log.e("ACRA", "Creating Sender Factory");
}
#NonNull
public ReportSender create(Context context, CoreConfiguration acraConfiguration) {
Log.e("ACRA", "Returning Report Sender");
return new ACRAReportSender();
}
}
Output as verified from logcat ( provided below)
1. 09-01 20:36:06.063 3938 3938 I ACRA : ACRA is enabled for com.example.myapplication, initializing..
2. ACRA : ACRA caught a RuntimeException for com.example.myapplication
3. 09-01 20:36:06.529 3938 3938 D ACRA : Building report
09-01 20:36:06.535 3938 4022 D ACRA : Calling collector org.acra.collector.LogCatCollector
09-01 20:36:06.536 3938 4020 D ACRA : Calling collector org.acra.collector.DropBoxCollector
09-01 20:36:06.536 3938 4020 D ACRA : Collector org.acra.collector.DropBoxCollector completed
09-01 20:36:06.536 3938 4020 D ACRA : Calling collector org.acra.collector.ReflectionCollecto..................
.......................
....................
ACRA : ServicePluginLoader loading services from ServiceLoader : java.util.ServiceLoader[org.acra.sender.ReportSenderFactory].......
...........................................
...........................................
09-01 20:36:06.586 3938 4010 D ACRA : Ignoring disabled ReportSenderFactory of type EmailIntentSenderFactory
09-01 20:36:06.586 3938 4010 D ACRA : reportSenderFactories : []
............................................................................
............................................................................
09-01 20:36:06.590 3938 4010 D ACRA : Checking plugin Configuration : org.acra.config.SchedulerConfiguration#1d3f9ef against plugin class : class org.acra.config.HttpSenderConfiguration
09-01 20:36:06.590 3938 4010 D ACRA : Checking plugin Configuration : org.acra.config.HttpSenderConfiguration#b426cfc against plugin class : class org.acra.config.HttpSenderConfiguration
**09-01 20:36:06.591 3938 4010 D ACRA : Ignoring disabled ReportSenderFactory of type HttpSenderFactory**
..............................................................
.............................................................
.............................................................
09-01 20:36:06.616 3938 3938 D ACRA : Ignoring disabled ReportInteraction of type NotificationInteraction
09-01 20:36:06.616 3938 3938 D ACRA : Mark 2020-09-01T20:36:06.565+05:30.stacktrace as approved.
09-01 20:36:06.617 3938 3938 D ACRA : Schedule report sending
09-01 20:36:06.626 3938 3938 D ACRA : config#reportSenderFactoryClasses : ImmutableList{[]}
09-01 20:36:06.626 3938 3938 D ACRA : Using PluginLoader to find ReportSender factories
The above logs says
a. Acra is getting initialized
b. acra is catching crash
c. report is approved
Query:
**1. Where am i going wrong. why is it not sending mail**
2. Is this, **"Ignoring disabled ReportSenderFactory of type HttpSenderFactory"**, as seen from the logs, the reason for not receiving reports via mail? If yes, how this can be rectified ?
Note: in manifest file, Internet permission is provided

Your ReportSenderFactory cannot be an inner class. Either make it a toplevel class or declare it static. It also must not be abstract.

Related

TFS task Run Power shell on remote machine Error: System.Management.Automation.RuntimeException: Failed to install 'VisualStudioRemoteDeployer'

In my TFS 2018 CD, i have a task `Run PowerShell on remote Machine' and it failed with error as follows
System.Management.Automation.RuntimeException: Failed to install 'VisualStudioRemoteDeployer
Find the task config as below
Find the complete error log as follows
2020-05-05T06:49:22.4862201Z Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."
2020-05-05T06:49:22.4862692Z CategoryInfo :NotSpecified: (:) [], MethodInvocationException
2020-05-05T06:49:22.4862987Z FullyQualifiedErrorId :Exception
2020-05-05T06:49:22.4863348Z ---> System.Management.Automation.RemoteException: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."
2020-05-05T06:49:22.4863751Z --- End of inner exception stack trace ---
2020-05-05T06:49:22.4864154Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
2020-05-05T06:49:22.4864655Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.InstallServiceInternal(String serviceSourcePath, String serviceName, String destinationFileName)
2020-05-05T06:49:22.4865266Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.RemoteDeploymentHelper.InstallService(String serviceSourcePath, String serviceName, String destinationFileName)
2020-05-05T06:49:22.4865783Z at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.DeploymentClient.<RunAsync>d__24.MoveNext()
2020-05-05T06:49:22.4866260Z ---> (Inner Exception #0) System.Management.Automation.RemoteException: Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."<---
2020-05-05T06:49:22.4866523Z
2020-05-05T06:49:22.4866665Z
2020-05-05T06:49:22.5010643Z Deployment status for machine 'XXXXX:5985' : 'Failed'
2020-05-05T06:49:22.5565354Z ##[error], MethodInvocationException\r\n FullyQualifiedErrorId :Exception\r\n"}};]
2020-05-05T06:49:22.5588511Z
2020-05-05T06:49:22.5588871Z
2020-05-05T06:49:22.5951437Z ##[error]System.Management.Automation.RuntimeException: Failed to install 'VisualStudioRemoteDeployerc87a55d0-555b-426c-b80f-1cf90ad0bf1c' from service executable path VisualStudioRemoteDeployer.exe . Consult the logs below:
2020-05-05T06:49:22.5952932Z Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."
2020-05-05T06:49:22.5953641Z CategoryInfo :NotSpecified: (:) [], MethodInvocationException
2020-05-05T06:49:22.5954109Z FullyQualifiedErrorId :Exception
2020-05-05T06:49:22.5954536Z ---> System.Management.Automation.RuntimeException: Failed to install 'VisualStudioRemoteDeployerc87a55d0-555b-426c-b80f-1cf90ad0bf1c' from service executable path VisualStudioRemoteDeployer.exe . Consult the logs below:
2020-05-05T06:49:22.5955018Z Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information."
2020-05-05T06:49:22.5955350Z CategoryInfo :NotSpecified: (:) [], MethodInvocationException
2020-05-05T06:49:22.5955636Z FullyQualifiedErrorId :Exception
2020-05-05T06:49:22.5955873Z
2020-05-05T06:49:22.5956133Z --- End of inner exception stack trace ---
2020-05-05T06:49:22.5956455Z at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2020-05-05T06:49:22.5959512Z at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2020-05-05T06:49:22.5959955Z at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2020-05-05T06:49:22.5960388Z at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)
2020-05-05T06:49:22.5960842Z at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings)
2020-05-05T06:49:22.5961295Z at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2020-05-05T06:49:22.6472008Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
This looks pretty related to this question. Root cause should be related to user access.
Ensure that user credentials provided in config has admin privileges over target machine and TFS. This would unblock the VisualStudioRemoteDeployer to run and eradicate SetRight" with "2" argument(s): "Could not obtain the user information issue.

How to handle UnkownProducerIdException

We are having some troubles with Spring Cloud and Kafka, at sometimes our microservice throws an UnkownProducerIdException, this is caused if the parameter transactional.id.expiration.ms is expired in the broker side.
My question, could it be possible to catch that exception and retry the failed message? If yes, what could be the best option to handle it?
I have took a look at:
- https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=89068820
- Kafka UNKNOWN_PRODUCER_ID exception
We are using Spring Cloud Hoxton.RELEASE version and Spring Kafka version 2.2.4.RELEASE
We are using AWS Kafka solution so we can't set a new value on that property I mentioned before.
Here is some trace of the exception:
2020-04-07 20:54:00.563 ERROR 5188 --- [ad | producer-2] o.a.k.c.p.internals.TransactionManager : [Producer clientId=producer-2] The broker returned org.apache.kafka.common.errors.UnknownProducerIdException: This exception is raised by the broker if it could not locate the producer metadata associated with the producerId in question. This could happen if, for instance, the producer's records were deleted because their retention time had elapsed. Once the last records of the producerId are removed, the producer's metadata is removed from the broker, and future appends by the producer will return this exception. for topic-partition test.produce.another-2 with producerId 35000, epoch 0, and sequence number 8
2020-04-07 20:54:00.563 INFO 5188 --- [ad | producer-2] o.a.k.c.p.internals.TransactionManager : [Producer clientId=producer-2] ProducerId set to -1 with epoch -1
2020-04-07 20:54:00.565 ERROR 5188 --- [ad | producer-2] o.s.k.support.LoggingProducerListener : Exception thrown when sending a message with key='null' and payload='{...}' to topic <some-topic>:
To reproduce this exception:
- I have used the confluent docker images and set the environment variable KAFKA_TRANSACTIONAL_ID_EXPIRATION_MS to 10 seconds so I wouldn't wait too much for this exception to be thrown.
- In another process, send one by one in interval of 10 seconds 1 message in the topic the java will listen.
Here is a code example:
File Bindings.java
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
public interface Bindings {
#Input("test-input")
SubscribableChannel testListener();
#Output("test-output")
MessageChannel testProducer();
}
File application.yml (don't forget to set the environment variable KAFKA_HOST):
spring:
cloud:
stream:
kafka:
binder:
auto-create-topics: true
brokers: ${KAFKA_HOST}
transaction:
producer:
error-channel-enabled: true
producer-properties:
acks: all
retry.backoff.ms: 200
linger.ms: 100
max.in.flight.requests.per.connection: 1
enable.idempotence: true
retries: 3
compression.type: snappy
request.timeout.ms: 5000
key.serializer: org.apache.kafka.common.serialization.StringSerializer
consumer-properties:
session.timeout.ms: 20000
max.poll.interval.ms: 350000
enable.auto.commit: true
allow.auto.create.topics: true
auto.commit.interval.ms: 12000
max.poll.records: 5
isolation.level: read_committed
configuration:
auto.offset.reset: latest
bindings:
test-input:
# contentType: text/plain
destination: test.produce
group: group-input
consumer:
maxAttempts: 3
startOffset: latest
autoCommitOnError: true
queueBufferingMaxMessages: 100000
autoCommitOffset: true
test-output:
# contentType: text/plain
destination: test.produce.another
group: group-output
producer:
acks: all
debug: true
The listener handler:
#SpringBootApplication
#EnableBinding(Bindings.class)
public class PocApplication {
private static final Logger log = LoggerFactory.getLogger(PocApplication.class);
public static void main(String[] args) {
SpringApplication.run(PocApplication.class, args);
}
#Autowired
private BinderAwareChannelResolver binderAwareChannelResolver;
#StreamListener(Topics.TESTLISTENINPUT)
public void listen(Message<?> in, String headerKey) {
final MessageBuilder builder;
MessageChannel messageChannel;
messageChannel = this.binderAwareChannelResolver.resolveDestination("test-output");
Object payload = in.getPayload();
builder = MessageBuilder.withPayload(payload);
try {
log.info("Event received: {}", in);
if (!messageChannel.send(builder.build())) {
log.error("Something happend trying send the message! {}", in.getPayload());
}
log.info("Commit success");
} catch (UnknownProducerIdException e) {
log.error("UnkownProducerIdException catched ", e);
} catch (KafkaException e) {
log.error("KafkaException catched ", e);
}catch (Exception e) {
System.out.println("Commit failed " + e.getMessage());
}
}
}
Regards
} catch (UnknownProducerIdException e) {
log.error("UnkownProducerIdException catched ", e);
To catch exceptions there, you need to set the sync kafka producer property (https://cloud.spring.io/spring-cloud-static/spring-cloud-stream-binder-kafka/3.0.3.RELEASE/reference/html/spring-cloud-stream-binder-kafka.html#kafka-producer-properties). Otherwise, the error comes back asynchronously
You should not "eat" the exception there; it must be thrown back to the container so the container will roll back the transaction.
Also,
}catch (Exception e) {
System.out.println("Commit failed " + e.getMessage());
}
The commit is performed by the container after the stream listener returns to the container so you will never see a commit error here; again, you must let the exception propagate back to the container.
The container will retry the delivery according to the consumer binding's retry configuration.
probably you can also use the callback function to handle the exception, not sure about the springframework lib for kafka, if using kafka client, you can something like this:
producer.send(record, new Callback() {
public void onCompletion(RecordMetadata metadata, Exception e) {
if(e != null) {
e.printStackTrace();
if(e.getClass().equals(UnknownProducerIdException.class)) {
logger.info("UnknownProducerIdException caught");
while(--retry>=0) {
send(topic,partition,msg);
}
}
} else {
logger.info("The offset of the record we just sent is: " + metadata.offset());
}
}
});

Curator Leader election give connection refused error

I implemented curator leader election example which is given in this site
Instead of having number of curator clients I added only one curator client as follows
public void selectLeader() {
CuratorFramework client = null;
try {
client = CuratorFrameworkFactory.newClient("localhost:2181", new ExponentialBackoffRetry(1000, 3));
LeaderSelectorService service = new LeaderSelectorService(client, "/leaderSelections", "LeaderElector");
client.start();
Thread.sleep(10000);
service.start();
} catch (Exception e) {
System.out.println("error"+e);
}finally
{
System.out.println("Shutting down...");
// CloseableUtils.closeQuietly(client);
}
}
public class LeaderSelectorService extends LeaderSelectorListenerAdapter implements Closeable {
private final String name;
private final LeaderSelector leaderSelector;
public LeaderSelectorService(CuratorFramework client, String path, String name) {
this.name = name;
// create a leader selector using the given path for management
// all participants in a given leader selection must use the same path
// ExampleClient here is also a LeaderSelectorListener but this isn't required
leaderSelector = new LeaderSelector(client, path, this);
// for most cases you will want your instance to requeue when it relinquishes leadership
leaderSelector.autoRequeue();
}
public void start() throws IOException
{
// the selection for this instance doesn't start until the leader selector is started
// leader selection is done in the background so this call to leaderSelector.start() returns immediately
leaderSelector.start();
}
#Override
public void takeLeadership(CuratorFramework arg0) throws Exception {
// we are now the leader. This method should not return until we want to relinquish leadership
final int waitSeconds = (int)(5 * Math.random()) + 1;
System.out.println(name + " is now the leader. Waiting " + waitSeconds + " seconds...");
//System.out.println(name + " has been leader " + leaderCount.getAndIncrement() + " time(s) before.");
try
{
Thread.sleep(TimeUnit.SECONDS.toMillis(waitSeconds));
}
catch ( InterruptedException e )
{
System.err.println(name + " was interrupted.");
Thread.currentThread().interrupt();
}
finally
{
System.out.println(name + " relinquishing leadership.\n");
}
}
#Override
public void close() throws IOException {
leaderSelector.close();
}
}
I have only one zookeeper instance and I am using Zookeeper 3.4.6, curator-framework 4.0.0 and curator-recipes 4.0.0.
when I start the client, it connects to zookeeper and in the log I can see "State change : connected" message.
Then I wait 10s and start leader election which gives me below error repeatedly.
2017-09-06 09:34:22.727 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Unable to read additional data from server sessionid 0x15e555a719d0000, likely server has closed socket, closing socket connection and attempting reconnect
2017-09-06 09:34:22.830 INFO 1228 --- [c-1-EventThread] o.a.c.f.state.ConnectionStateManager : State change: SUSPENDED
2017-09-06 09:34:23.302 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2017-09-06 09:34:23.303 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Socket connection established, initiating session, client: /127.0.0.1:49594, server: localhost/127.0.0.1:2181
2017-09-06 09:34:23.305 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x15e555a719d0000, negotiated timeout = 120000
2017-09-06 09:34:23.305 INFO 1228 --- [c-1-EventThread] o.a.c.f.state.ConnectionStateManager : State change: RECONNECTED
2017-09-06 09:34:23.310 WARN 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session 0x15e555a719d0000 for server localhost/127.0.0.1:2181, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[na:1.8.0_131]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[na:1.8.0_131]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[na:1.8.0_131]
at sun.nio.ch.IOUtil.read(IOUtil.java:192) ~[na:1.8.0_131]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[na:1.8.0_131]
at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:75) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1214) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
after some time it started to give me below error message.
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.zookeeper.KeeperException.create(KeeperException.java:99) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.curator.framework.imps.CuratorFrameworkImpl.checkBackgroundRetry(CuratorFrameworkImpl.java:831) [curator-framework-4.0.0.jar:4.0.0]
at org.apache.curator.framework.imps.CuratorFrameworkImpl.processBackgroundOperation(CuratorFrameworkImpl.java:623) [curator-framework-4.0.0.jar:4.0.0]
at org.apache.curator.framework.imps.WatcherRemovalFacade.processBackgroundOperation(WatcherRemovalFacade.java:152) [curator-framework-4.0.0.jar:4.0.0]
at org.apache.curator.framework.imps.GetConfigBuilderImpl$2.processResult(GetConfigBuilderImpl.java:222) [curator-framework-4.0.0.jar:4.0.0]
at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:590) [zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:499) [zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
2017-09-06 09:34:31.897 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2017-09-06 09:34:31.898 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Socket connection established, initiating session, client: /127.0.0.1:49611, server: localhost/127.0.0.1:2181
2017-09-06 09:34:31.899 INFO 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x15e555a719d0000, negotiated timeout = 120000
2017-09-06 09:34:31.899 INFO 1228 --- [c-1-EventThread] o.a.c.f.state.ConnectionStateManager : State change: RECONNECTED
2017-09-06 09:34:31.907 WARN 1228 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session 0x15e555a719d0000 for server localhost/127.0.0.1:2181, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: Xid out of order. Got Xid 41 with err -6 expected Xid 40 for a packet with details: clientPath:/leaderSelections serverPath:/leaderSelections finished:false header:: 40,12 replyHeader:: 0,0,-4 request:: '/leaderSelections,F response:: v{}
at org.apache.zookeeper.ClientCnxn$SendThread.readResponse(ClientCnxn.java:892) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:101) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1214) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
I tried several solution in the internet but non got succeeded. Does anybody know the root cause of this issue.
I have fixed this issue. There was version number mismatch between zookeeper version and curator version. I used curator version 4.0.0 with zookeeper 3.4.6. According to apache curator site
Curator 4.0.0 - compatible with ZooKeeper 3.5.x. I changed my curator version to 2.8.0

Upload a file as iFile using iControl

Is there a way to update the contents of an existing iFile? I didn't see any way to update the contents. So, I started looking at deleting and creating a file by uploading a local file to the BigIP using the iControl. I understand there are two objects to use - iFileFile and then iFile in that order.
Can somebody please provide usage for this? Below is what I started with and get the error below. What would be the correct parameters for iFileFile.create() if I have a file named random_key_file1 in the same location as the powershell script? After creating the iFileFile object, how do I use the same in the iFile.create().
Below links have documentation but lack the ussage examples : https://devcentral.f5.com/wiki/iControl.LocalLB__iFile__create.ashx https://devcentral.f5.com/wiki/iControl.LocalLB__iFileFile__create.ashx
Appreciate the help.
Add-PSSnapIn iControlSnapIn
$conn = Initialize-F5.iControl -HostName $hostName -Username $username -Password $password
if($conn) {
Try
{
Write-Output "Connected to load balancer - $hostName"
$ic = Get-F5.iControl
$iFileFileObjectNames = #("file1")
$filePaths = #("random_key_file1")
$ic.LocalLBiFileFile.create($iFileFileObjectNames,$filePaths)
Write-Output ("file created")
}
Catch
{
Write-Output($error[0]|format-list -force)
}
}
else
{
Write-Error "Connection to loadbalancer failed"
}
ERROR
Exception : System.Management.Automation.MethodInvocationException: Exception calling "create" with "2"
argument(s): "Exception caught in LocalLB::urn:iControl:LocalLB/iFileFile::create()
Common::InvalidArgument
" ---> System.Web.Services.Protocols.SoapHeaderException: Exception caught in
LocalLB::urn:iControl:LocalLB/iFileFile::create()
Common::InvalidArgument
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[]
parameters)
at CallSite.Target(Closure , CallSite , Object , Object , Object )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : SoapHeaderException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, D:\test.ps1: line 35
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :
Answer this Question 0

Spring batch - Commit failed while step execution data was already updated error at custom writer

After the writer class ends. The error occurs in spring batch execution.
all of read data is to be rollback and chunk data is not inserted to DB.
What is that mean of "Commit failed while step execution data was already updated error"? And why does occur this log?
Is it problem that may time of insert transaction in writer?
If there is one time of insert transaction(commented out to 'recordDataService.insertRecordData(recordData);', there is no problem.
My Code :
#Override
public void write(List<? extends RecordInfo> items) {
log.info("########################################################");
log.info("write");
log.info("########################################################");
recordInfoService.insertRecordInfo(recordInfos.get(0));
for( RecordData recordData : recordInfos.get(0).getRecordDataList()){
recordDataService.insertRecordData(recordData);
}
The Log of each other writer :
2015-07-17 00:05:38.995 INFO 42558 --- [ main] c.s.c.b.j.c.CollectRecordItemWriter : ########################################################
2015-07-17 00:05:38.995 INFO 42558 --- [ main] c.s.c.b.j.c.CollectRecordItemWriter : write
2015-07-17 00:05:38.995 INFO 42558 --- [ main] c.s.c.b.j.c.CollectRecordItemWriter : ########################################################
2015-07-17 16:34:26.921 INFO 41111 --- [ main] o.s.jdbc.support.SQLErrorCodesFactory : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]
2015-07-16 02:30:25.734 INFO 60636 --- [ main] o.s.batch.core.step.tasklet.TaskletStep : Commit failed while step execution data was already updated. Reverting to old version.
The Log of Execution : everything was to be rollback
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Step collectRecordStep
WriteCount: 0
ReadCount: 14
ReadSkipCount: 0
Commits: 1
SkipCount: 0
Rollbacks: 14
Filter: 0
+++++++++++++++++++++++++++++++++++++++++++++++++++++