softwaremill / elasticmq

In-memory message queue with an Amazon SQS-compatible interface. Runs stand-alone or embedded.
https://softwaremill.com/open-source/
Apache License 2.0
2.46k stars 193 forks source link

Crashes when SQL persistence is enabled in the `elasticmq-native` image #1007

Closed Ferenc- closed 3 weeks ago

Ferenc- commented 4 weeks ago

Running podman run --pod=sqs-pod --rm -v "${PWD}/custom.conf":/opt/elasticmq.conf -v "${PWD}/data":/data softwaremill/elasticmq-native:1.6.2, with

include classpath("application.conf")

messages-storage {
  enabled = true
}

queues {
  queue1 {
    defaultVisibilityTimeout = 10 seconds
    delay = 5 seconds
    receiveMessageWait = 0 seconds
    deadLettersQueue {
      name = "queue1-dead-letters"
      maxReceiveCount = 3 // from 1 to 1000
    }
    fifo = false
    contentBasedDeduplication = false
    copyTo = "audit-queue-name"
    moveTo = "redirect-queue-name"
    tags {
      tag1 = "tagged1"
      tag2 = "tagged2"
    }
  }
  queue1-dead-letters { }
  audit-queue-name { }
  redirect-queue-name { }
}

Leads to crashes, once there is a write to the queue:

Uncaught error from thread [elasticmq-pekko.actor.default-dispatcher-18]: null, shutting down JVM since 'pekko.jvm-exit-on-fatal-error' is enabled for ActorSystem[elasticmqUncaught error fro
m thread [elasticmq-pekko.actor.default-dispatcher-15]: Could not initialize class org.elasticmq.persistence.sql.SerializableAttributeProtocol$, shutting down JVM since 'pekko.jvm-exit-on-fa
tal-error' is enabled for ActorSystem[elasticmq]                                                                                                                                              
]                                                                                                                                                                                             
java.lang.ExceptionInInitializerError                                                                                                                                                         
        at org.elasticmq.persistence.sql.DBMessage$.from(DBMessage.scala:104)                                                                                                                
        at org.elasticmq.persistence.sql.MessageRepository.add(MessageRepository.scala:51)                                                                                                    
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor$$anonfun$receive$1.$anonfun$applyOrElse$2(SqlQueuePersistenceActor.scala:60)                                                
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor$$anonfun$receive$1.$anonfun$applyOrElse$2$adapted(SqlQueuePersistenceActor.scala:60)                                        
        at scala.Option.foreach(Option.scala:437)                                                                                                                
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor$$anonfun$receive$1.applyOrElse(SqlQueuePersistenceActor.scala:60)                                                          
        at org.apache.pekko.actor.Actor.aroundReceive(Actor.scala:547)                                                                                
        at org.apache.pekko.actor.Actor.aroundReceive$(Actor.scala:545)                                                                                                                      
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor.aroundReceive(SqlQueuePersistenceActor.scala:19)                                                                           
        at org.apache.pekko.actor.ActorCell.receiveMessage(ActorCell.scala:590)                                                                       
        at org.apache.pekko.actor.ActorCell.invoke(ActorCell.scala:557)                                                                                                                      
        at org.apache.pekko.dispatch.Mailbox.processMailbox(Mailbox.scala:280)                                                                                                               
        at org.apache.pekko.dispatch.Mailbox.run(Mailbox.scala:241)                                                                                                                          
        at org.apache.pekko.dispatch.Mailbox.exec(Mailbox.scala:253)                                                                                                                          
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)                                                                                                                   
        at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)                                                                                                  
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)                                                                                                                    
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)                                                                                                                
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)                                                                                                       
        at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)                                                                                            
        at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:202)                                                                           
Caused by: scala.MatchError: [Ljava.lang.String;@43dd6cc0 (of class [Ljava.lang.String;)                                                                                                      
        at spray.json.ProductFormatsInstances.jsonFormat4(ProductFormatsInstances.scala:92)                                                                                                  
        at spray.json.ProductFormatsInstances.jsonFormat4$(ProductFormatsInstances.scala:91)                                                                                                  
        at org.elasticmq.persistence.sql.SerializableAttributeProtocol$.jsonFormat4(package.scala:12)                                                                                         
        at org.elasticmq.persistence.sql.SerializableAttributeProtocol$.<clinit>(package.scala:13)                                                                                            
        ... 21 more                                                                                                                                                                           
java.lang.NoClassDefFoundError: Could not initialize class org.elasticmq.persistence.sql.SerializableAttributeProtocol$                                                    
        at org.elasticmq.persistence.sql.DBMessage$.from(DBMessage.scala:104)                                                                                                                 
        at org.elasticmq.persistence.sql.MessageRepository.add(MessageRepository.scala:51)                                               
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor$$anonfun$receive$1.$anonfun$applyOrElse$2(SqlQueuePersistenceActor.scala:60)                                                
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor$$anonfun$receive$1.$anonfun$applyOrElse$2$adapted(SqlQueuePersistenceActor.scala:60)                                        
        at scala.Option.foreach(Option.scala:437)                                                                                                                
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor$$anonfun$receive$1.applyOrElse(SqlQueuePersistenceActor.scala:60)                                                           
        at org.apache.pekko.actor.Actor.aroundReceive(Actor.scala:547)                                                                                                                        
        at org.apache.pekko.actor.Actor.aroundReceive$(Actor.scala:545)                                                                                                                       
        at org.elasticmq.persistence.sql.SqlQueuePersistenceActor.aroundReceive(SqlQueuePersistenceActor.scala:19)                                                                           
        at org.apache.pekko.actor.ActorCell.receiveMessage(ActorCell.scala:590)                                                                                                               
        at org.apache.pekko.actor.ActorCell.invoke(ActorCell.scala:557)
        at org.apache.pekko.dispatch.Mailbox.processMailbox(Mailbox.scala:280)
micossow commented 3 weeks ago

Thanks for reporting the issue. Can you confirm it works with 1.6.3?

Ferenc- commented 3 weeks ago

Thanks for reporting the issue. Can you confirm it works with 1.6.3?

Confirmed.