Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-3921

TokenMgrError causes LuceneMessageSearchIndex to fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.9.0
    • 3.9.0, 3.8.1
    • None
    • None

    Description

      While importing emails I get terminal error from LuceneMessageSearchIndex:

       

      06:20:25.865 [ERROR] o.a.j.e.d.EventDelivery$Retryer$BackoffRetryer - listener org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex exceeded maximum retry(8) to handle event org.apache.james.mailbox.events.MailboxEvents.Added
      org.apache.james.mime4j.field.datetime.parser.TokenMgrError: Lexical error at line 1, column 1.  Encountered: "\u00cf" (207), after : ""
              at org.apache.james.mime4j.field.datetime.parser.DateTimeParserTokenManager.getNextToken(DateTimeParserTokenManager.java:1050)
              at org.apache.james.mime4j.field.datetime.parser.DateTimeParser.jj_ntk(DateTimeParser.java:544)
              at org.apache.james.mime4j.field.datetime.parser.DateTimeParser.date_time(DateTimeParser.java:142)
              at org.apache.james.mime4j.field.datetime.parser.DateTimeParser.parseAll(DateTimeParser.java:134)
              at org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex$1.headers(LuceneMessageSearchIndex.java:633)
              at org.apache.james.mime4j.message.SimpleContentHandler.endHeader(SimpleContentHandler.java:93)
              at org.apache.james.mime4j.parser.MimeStreamParser.parse(MimeStreamParser.java:140)
              at org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex.createMessageDocument(LuceneMessageSearchIndex.java:777)
              at org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex.lambda$add$3(LuceneMessageSearchIndex.java:1261)
              at com.github.fge.lambdas.runnable.RunnableChainer.doRun(RunnableChainer.java:18)
              at com.github.fge.lambdas.runnable.ThrowingRunnable.run(ThrowingRunnable.java:16)
              at reactor.core.publisher.MonoRunnable.call(MonoRunnable.java:73)
              at reactor.core.publisher.MonoRunnable.call(MonoRunnable.java:32)
              at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.onNext(FluxConcatMapNoPrefetch.java:190)
              ... 9 common frames omitted
      Wrapped by: reactor.core.Exceptions$RetryExhaustedException: Retries exhausted: 8/8
              at reactor.core.Exceptions.retryExhausted(Exceptions.java:306)
              at reactor.util.retry.RetryBackoffSpec.lambda$static$0(RetryBackoffSpec.java:68)
              at reactor.util.retry.RetryBackoffSpec.lambda$null$4(RetryBackoffSpec.java:560)
              at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.onNext(FluxConcatMapNoPrefetch.java:183)
              at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
              at reactor.core.publisher.SinkManyEmitterProcessor.drain(SinkManyEmitterProcessor.java:471)
              at reactor.core.publisher.SinkManyEmitterProcessor.tryEmitNext(SinkManyEmitterProcessor.java:269)
              at reactor.core.publisher.SinkManySerialized.tryEmitNext(SinkManySerialized.java:100)
              at reactor.core.publisher.InternalManySink.emitNext(InternalManySink.java:27)
              at reactor.core.publisher.FluxRetryWhen$RetryWhenMainSubscriber.onError(FluxRetryWhen.java:190)
              at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onError(MonoIgnoreElements.java:84)
              at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onError(MonoPeekTerminal.java:258)
              at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onError(FluxContextWrite.java:121)
              at reactor.core.publisher.MonoUsing$MonoUsingSubscriber.onError(MonoUsing.java:260)
              at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onError(MonoIgnoreThen.java:278)
              at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:241)
              at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:315)
              at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onError(MonoIgnoreElements.java:84)
              at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.maybeOnError(FluxConcatMapNoPrefetch.java:326)
              at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.onNext(FluxConcatMapNoPrefetch.java:211)
              at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.runAsync(FluxPublishOn.java:440)
              at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.run(FluxPublishOn.java:527)
              at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
              at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
              at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
              at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
              at java.base/java.lang.Thread.run(Unknown Source)

       

      Naive option to add the TokenMgrError to the catch block seems to work https://github.com/apache/james-project/blob/main/mailbox/lucene/src/main/java/org/apache/james/mailbox/lucene/search/LuceneMessageSearchIndex.java#L638-L638

      though I think org.apache.james.mime4j.field.datetime.parser.DateTimeParser#parseAll should throw ParseException in this case as well. However, in this case ((DateTimeField) f).getDate(); is still null as the datetime seems like a complete gibberish

      Attachments

        Activity

          People

            Unassigned Unassigned
            .wojtek Wojtek
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 40m
                2h 40m