Skip to content

Failed to start standalone pulsar on Apple M1 #12166

Closed

Description

@Thearas

Describe the bug
I follow the document https://pulsar.apache.org/docs/en/standalone-docker/#start-pulsar-in-docker, run the following command:

docker run -it -p 6650:6650 \
  -p 8080:8080 \
  --mount source=pulsardata,target=/pulsar/data \
  --mount source=pulsarconf,target=/pulsar/conf \
  --name pulsar apachepulsar/pulsar:2.8.0 \
  bin/pulsar standalone --no-stream-storage --no-functions-worker

but got an error:

03:47:27.880 [main] ERROR org.apache.pulsar.PulsarStandaloneStarter - Failed to start pulsar service.
java.lang.ExceptionInInitializerError: null
	at org.eclipse.jetty.http.MimeTypes.<clinit>(MimeTypes.java:175) ~[org.eclipse.jetty-jetty-http-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:895) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288) ~[org.eclipse.jetty-jetty-servlet-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.handler.StatisticsHandler.doStart(StatisticsHandler.java:253) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.Server.start(Server.java:423) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.server.Server.doStart(Server.java:387) ~[org.eclipse.jetty-jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[org.eclipse.jetty-jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.apache.pulsar.broker.web.WebService.start(WebService.java:241) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0]
	at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:723) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0]
	at org.apache.pulsar.PulsarStandalone.start(PulsarStandalone.java:296) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0]
	at org.apache.pulsar.PulsarStandaloneStarter.main(PulsarStandaloneStarter.java:121) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0]
Caused by: java.nio.charset.IllegalCharsetNameException: l;charset=iso-8859-1
	at java.nio.charset.Charset.checkName(Charset.java:308) ~[?:?]
	at java.nio.charset.Charset.lookup2(Charset.java:482) ~[?:?]
	at java.nio.charset.Charset.lookup(Charset.java:462) ~[?:?]
	at java.nio.charset.Charset.forName(Charset.java:526) ~[?:?]
	at org.eclipse.jetty.http.MimeTypes$Type.<init>(MimeTypes.java:107) ~[org.eclipse.jetty-jetty-http-9.4.42.v20210604.jar:9.4.42.v20210604]
	at org.eclipse.jetty.http.MimeTypes$Type.<clinit>(MimeTypes.java:67) ~[org.eclipse.jetty-jetty-http-9.4.42.v20210604.jar:9.4.42.v20210604]
	... 27 more

To Reproduce

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: macOS
    Darwin ThearasdeMacBook-Pro-13.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 arm64

Additional context
Full log:
error.log

Activity

  1. added
    type/bug
    on Sep 24, 2021
  2. Thearas commented on Sep 24, 2021

    @Thearas
    Author

    Looks like it's a common problem localstack/localstack#4456 (comment).

  3. changed the title [-]Failed to start standalone pulsar[/-] [+]Failed to start standalone pulsar on Apple M1[/+] on Sep 24, 2021
  4. leroyj commented on Nov 15, 2021

    @leroyj

    It probably comes from RocksDB jni lib that is compiled for Intel architecture but not for M1.
    I have the following message when I try to start Pulsar standalone manually

    [...]
    18:06:01.614 [main] ERROR org.apache.pulsar.PulsarStandaloneStarter - Failed to start pulsar service.
    java.io.IOException: Failed to load RocksDB JNI library
    	at org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageRocksDB.<init>(KeyValueStorageRocksDB.java:97) ~[org.apache.bookkeeper-bookkeeper-server-4.14.2.jar:4.14.2]
    [...]
    Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/lg/rlmz38310975xp7d3_q1bq280000gn/T/librocksdbjni853977630215260542.jnilib: dlopen(/private/var/folders/lg/rlmz38310975xp7d3_q1bq280000gn/T/librocksdbjni853977630215260542.jnilib, 0x0001): tried: '/private/var/folders/lg/rlmz38310975xp7d3_q1bq280000gn/T/librocksdbjni853977630215260542.jnilib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/librocksdbjni853977630215260542.jnilib' (no such file), '/usr/lib/librocksdbjni853977630215260542.jnilib' (no such file)
    

    There's an open issue (facebook/rocksdb#7720) in RocksDB that @jurmous helps to fix by building a universal version of the lib.

  5. ilkomiliev commented on Jan 19, 2022

    @ilkomiliev

    yes, this comes from RocksDB JNI. Unfortunately, it seems that the API changed also, so that the lib version mentioned in the original rocksdb issue (rocksdbjni-6.25.3.jar) brings another error:

    java.lang.NoSuchMethodError: 'org.rocksdb.ReadOptions org.rocksdb.ReadOptions.setIterateUpperBound(org.rocksdb.Slice)' at org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageRocksDB.getFloor(KeyValueStorageRocksDB.java:257) ~[org.apache.bookkeeper-bookkeeper-server-4.14.2.jar:4.14.2]

    I looked at the history and the method signature has been changed to refer to some generic Slice implementation. Any chance to get this working on M1?

  6. github-actions commented on Mar 1, 2022

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  7. ilkomiliev commented on Mar 1, 2022

    @ilkomiliev

    just to keep this not to be closed - can we have an ETA for the fix of this?

  8. devinbost commented on Mar 27, 2022

    @devinbost
    Contributor

    There has been a new release of the RocksDB library that resolves this issue: meta/rocksdb#7720 (comment)

    How quickly can we get this updated in BookKeeper?
    @eolivelli

  9. eolivelli commented on Mar 27, 2022

    @eolivelli
    Contributor

    @devinbost this is the patch for Pulsar
    #14886

  10. zzzming commented on Mar 27, 2022

    @zzzming
    Contributor

    There is also an earlier PR #14005
    An arm64 docker image is needed

  11. added this to the 2.11.0 milestone on Mar 28, 2022
  12. lhotari commented on Mar 31, 2022

    @lhotari
    Member

    Upgrading RocksDB requires compiling the recompiling the code that uses Rocksdb. The library cannot simply be swapped. We need a new Bookkeeper release with the upgraded version. I have reverted the Rocksdb upgrade in #14962 .

  13. lhotari commented on Mar 31, 2022

    @lhotari
    Member

    RocksDB broke binary compatibility in 6.17.3 release. explained in #14962 (comment)

  14. lhotari commented on Apr 1, 2022

    @lhotari
    Member

    "There is no guarantee of Binary Compatibility between RocksDB versions, I am afraid you will have to recompile."
    meta/rocksdb@1001bc0#r70067997

  15. lhotari commented on Apr 1, 2022

    @lhotari
    Member

    We need a new BookKeeper release with support for a newer RocksDB since the version cannot be upgraded without recompiling the source code.

    The RocksDB upgrade was discussed in the Pulsar community meeting on March 31st (meeting notes, thank you @michaeljmarshall ).

    • Matteo: discussing RocksDB version nuances and making sure Pulsar
      Standalone works on Arm machines (particularly MacOS). Part of the
      question is whether or not we can do a major upgrade of RocksDB in a
      minor or patch release of Bookkeeper. Andrey asked whether or not we
      could upgrade RocksDB on older versions. Matteo thinks we shouldn’t
      upgrade RocksDB in existing stable versions of Pulsar (2.8 to 2.10).
      Andrey asks about users running with Arm and wanting to test out old
      versions, and Matteo mentioned that he would prefer not to introduce a
      possible regression in the production just to get it to work on MacOS.
      Andrey agreed.

    I believe that this decision is to be made in the BookKeeper project.
    It seems that RocksDB has already been upgraded to 6.29.x in branch-4.14 by this commit: apache/bookkeeper@0e7f8f42 .
    @merlimat @dlg99 @eolivelli @nicoloboschi, is this fine? It means that Pulsar 2.8.x+ would be getting this upgrade eventually if we want to get maintenance updates from BookKeeper for 4.14.x . Pulsar 2.8.x+ is on BK 4.14.4 currently.
    There's a conflict with what was discussed yesterday, "Matteo thinks we shouldn’t upgrade RocksDB in existing stable versions of Pulsar (2.8 to 2.10)."

  16. eolivelli commented on Apr 1, 2022

    @eolivelli
    Contributor

    Let's keep the BK discussion in BK project

  17. modified the milestones: 2.11.0, 2.12.0 on Jul 26, 2022
  18. tisonkun commented on Sep 6, 2022

    @tisonkun
    Member

    Failed to load RocksDB JNI library

    This is resolved in >= 2.11.0. If we don't pick the upgrade to previous versions, then that's the final state.

    @eolivelli @lhotari we can close this issue as closed. It works for me on Apple M1 machine with branch-2.11 or master.

  19. tisonkun commented on Dec 24, 2022

    @tisonkun
    Member

    Closed as resolved and information delivered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedtype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions