influxdb-java icon indicating copy to clipboard operation
influxdb-java copied to clipboard

UnauthorizedException after a while when connecting with influxdb-java [influxdb v2.0]

Open yyvus opened this issue 6 years ago • 3 comments

We run an influxdb-java code that sinks data from kafka into the influxdb v2.0 database. The code works fine for a while (couple of days) and then suddenly throws the UnauthorizedException.

SEVERE: The error occurred during writing of data

com.influxdb.exceptions.UnauthorizedException: unauthorized access at
com.influxdb.internal.AbstractRestClient.responseToError(AbstractRestClient.java:98) at
com.influxdb.client.internal.AbstractWriteClient.toInfluxException(AbstractWriteClient.java:533) at
com.influxdb.client.internal.AbstractWriteClient.lambda$new$7(AbstractWriteClient.java:155) at
io.reactivex.internal.subscribers.LambdaSubscriber.onNext(LambdaSubscriber.java:65) at
io.reactivex.internal.operators.mixed.FlowableConcatMapMaybe$ConcatMapMaybeSubscriber.drain(FlowableConcatMapMaybe.java:284) at
io.reactivex.internal.operators.mixed.FlowableConcatMapMaybe$ConcatMapMaybeSubscriber.onNext(FlowableConcatMapMaybe.java:137) at
io.reactivex.internal.operators.mixed.FlowableConcatMapSingle$ConcatMapSingleSubscriber.drain(FlowableConcatMapSingle.java:279) at
io.reactivex.internal.operators.mixed.FlowableConcatMapSingle$ConcatMapSingleSubscriber.innerSuccess(FlowableConcatMapSingle.java:179) at
io.reactivex.internal.operators.mixed.FlowableConcatMapSingle$ConcatMapSingleSubscriber$ConcatMapSingleObserver.onSuccess(FlowableConcatMapSingle.java:317) at
io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64) at
io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64) at
io.reactivex.internal.operators.flowable.FlowableCollectSingle$CollectSubscriber.onComplete(FlowableCollectSingle.java:119) at
io.reactivex.internal.subscribers.BasicFuseableSubscriber.onComplete(BasicFuseableSubscriber.java:120) at
io.reactivex.internal.subscribers.BasicFuseableConditionalSubscriber.onComplete(BasicFuseableConditionalSubscriber.java:119) at
io.reactivex.internal.operators.flowable.FlowableGroupBy$State.checkTerminated(FlowableGroupBy.java:687) at
io.reactivex.internal.operators.flowable.FlowableGroupBy$State.drainNormal(FlowableGroupBy.java:627) at
io.reactivex.internal.operators.flowable.FlowableGroupBy$State.drain(FlowableGroupBy.java:559) at
io.reactivex.internal.operators.flowable.FlowableGroupBy$State.onComplete(FlowableGroupBy.java:549) at
io.reactivex.internal.operators.flowable.FlowableGroupBy$GroupedUnicast.onComplete(FlowableGroupBy.java:475) at
io.reactivex.internal.operators.flowable.FlowableGroupBy$GroupBySubscriber.onComplete(FlowableGroupBy.java:213) at
io.reactivex.processors.UnicastProcessor.checkTerminated(UnicastProcessor.java:431) at
io.reactivex.processors.UnicastProcessor.drainRegular(UnicastProcessor.java:314) at
io.reactivex.processors.UnicastProcessor.drain(UnicastProcessor.java:398) at
io.reactivex.processors.UnicastProcessor.onComplete(UnicastProcessor.java:488) at
io.reactivex.internal.operators.flowable.FlowableWindowBoundary$WindowBoundaryMainSubscriber.drain(FlowableWindowBoundary.java:237) at
io.reactivex.internal.operators.flowable.FlowableWindowBoundary$WindowBoundaryMainSubscriber.innerNext(FlowableWindowBoundary.java:149) at
io.reactivex.internal.operators.flowable.FlowableWindowBoundary$WindowBoundaryInnerSubscriber.onNext(FlowableWindowBoundary.java:281) at
io.reactivex.processors.PublishProcessor$PublishSubscription.onNext(PublishProcessor.java:360) at
io.reactivex.processors.PublishProcessor.onNext(PublishProcessor.java:243) at
io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.tryEmit(FlowableFlatMap.java:282) at
io.reactivex.internal.operators.flowable.FlowableFlatMap$InnerSubscriber.onNext(FlowableFlatMap.java:663) at
io.reactivex.processors.PublishProcessor$PublishSubscription.onNext(PublishProcessor.java:360) at io.reactivex.processors.PublishProcessor.offer(PublishProcessor.java:301) at
com.influxdb.client.internal.AbstractWriteClient.flush(AbstractWriteClient.java:171) at
PACKAGE.influxdb.sink.KafkaInfluxdbSink.transferData(KafkaInfluxdbSink.java:104) at
PACKAGE.influxdb.MainService.main(MainService.java:19)

Question: is there anyone else facing this difficulty and is there a timeout in the influxdb-java client authentication process. Because I found nothing in the influxdb documentation of the v1.7 and the v2.0 documentation seems not ready yet.

Moreover, I don't manage to identify the first UnauthorizedException since it works for a while. So I cannot relate this to an other exception that eventually occured before this one...

See the SO related question: SO

Influxdb-java:

                <dependency>
			<groupId>com.influxdb</groupId>
			<artifactId>influxdb-client-java</artifactId>
			<version>1.2.0</version>
		</dependency>

Influxdb: v2.0 alpha

java: openjdk 13.0.1

yyvus avatar Dec 11 '19 08:12 yyvus

I have then seen that there is an update on the maven repository 1.2.0 -> 1.3.0. I just pushed the update and will keep you informed on the effect.

yyvus avatar Dec 11 '19 08:12 yyvus

Hi, you are talking about a different java client library, the git repo of that is: https://github.com/influxdata/influxdb-client-java Please reopen the issue there.

majst01 avatar Dec 11 '19 09:12 majst01

Sorry.

yyvus avatar Dec 11 '19 10:12 yyvus