Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem loading sqlite*.so when mount /tmp -o noexec #1195

Closed
ulm-su opened this issue Oct 13, 2024 · 2 comments
Closed

Problem loading sqlite*.so when mount /tmp -o noexec #1195

ulm-su opened this issue Oct 13, 2024 · 2 comments
Labels
bug Something isn't working released Issue has been released

Comments

@ulm-su
Copy link

ulm-su commented Oct 13, 2024

Describe the bug

java.sql.SQLException: Error opening connection
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:283)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:67)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:19)
        at org.sqlite.JDBC.createConnection(JDBC.java:106)
        at org.sqlite.JDBC.connect(JDBC.java:79)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:252)
        at su.ulm.rustore.server.Server.lambda$main$0(Server.java:126)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalArgumentException: can't parse argument number:
        at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1454)
        at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:492)
        at java.base/java.text.MessageFormat.<init>(MessageFormat.java:371)
        at java.base/java.text.MessageFormat.format(MessageFormat.java:860)
        at org.sqlite.util.LoggerFactory$JDKLogger.error(LoggerFactory.java:83)
        at org.sqlite.SQLiteJDBCLoader.loadNativeLibrary(SQLiteJDBCLoader.java:270)
        at org.sqlite.SQLiteJDBCLoader.extractAndLoadLibraryFile(SQLiteJDBCLoader.java:223)
        at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:330)
        at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:75)
        at org.sqlite.core.NativeDB.load(NativeDB.java:69)
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:280)
        ... 9 more
Caused by: java.lang.NumberFormatException: For input string: ""
        at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
        at java.base/java.lang.Integer.parseInt(Integer.java:678)
        at java.base/java.lang.Integer.parseInt(Integer.java:786)
        at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1452)
        ... 19 more

To Reproduce

sudo mount /tmp -o remount,noexec

Expected behavior

SEVERE: Failed to load native library: sqlite-3.46.1.3-648ef3c4-3110-4a81-a9f0-0be9e5df47e8-libsqlitejdbc.so. osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: /tmp/sqlite-3.46.1.3-648ef3c4-3110-4a81-a9f0-0be9e5df47e8-libsqlitejdbc.so: /tmp/sqlite-3.46.1.3-648ef3c4-3110-4a81-a9f0-0be9e5df47e8-libsqlitejdbc.so: failed to map segment from shared object                                                                                                                                                                          at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389)
        at java.base/java.lang.Runtime.load0(Runtime.java:755).
        at java.base/java.lang.System.load(System.java:1953)
        at org.sqlite.SQLiteJDBCLoader.loadNativeLibrary(SQLiteJDBCLoader.java:266)
        at org.sqlite.SQLiteJDBCLoader.extractAndLoadLibraryFile(SQLiteJDBCLoader.java:223)
        at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:330)
        at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:75)
        at org.sqlite.core.NativeDB.load(NativeDB.java:69)
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:280)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:67)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:19)
        at org.sqlite.JDBC.createConnection(JDBC.java:106)
        at org.sqlite.JDBC.connect(JDBC.java:79)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:252)
        at su.ulm.rustore.server.Server.lambda$main$0(Server.java:126)
        at java.base/java.lang.Thread.run(Thread.java:833)

Oct 13, 2024 11:29:31 AM org.sqlite.util.LoggerFactory$JDKLogger error
SEVERE: Failed to load native library through System.loadLibrary
java.lang.UnsatisfiedLinkError: no sqlitejdbc in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2429)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
        at java.base/java.lang.System.loadLibrary(System.java:1989)
        at org.sqlite.SQLiteJDBCLoader.loadNativeLibraryJdk(SQLiteJDBCLoader.java:285)
        at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:354)
        at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:75)
        at org.sqlite.core.NativeDB.load(NativeDB.java:69)
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:280)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:67)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:19)
        at org.sqlite.JDBC.createConnection(JDBC.java:106)
        at org.sqlite.JDBC.connect(JDBC.java:79)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:252)
        at su.ulm.rustore.server.Server.lambda$main$0(Server.java:126)
        at java.base/java.lang.Thread.run(Thread.java:833)

java.sql.SQLException: Error opening connection
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:283)
        at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:67)
        at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:28)
        at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:19)
        at org.sqlite.JDBC.createConnection(JDBC.java:106)
        at org.sqlite.JDBC.connect(JDBC.java:79)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:681)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:252)
        at su.ulm.rustore.server.Server.lambda$main$0(Server.java:126)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.sqlite.NativeLibraryNotFoundException: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
        at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:361)
        at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:75)
        at org.sqlite.core.NativeDB.load(NativeDB.java:69)
        at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:280)
        ... 9 more

Logs
See above.

Environment:

  • OS: Linux
  • CPU architecture: x86_64
  • sqlite-jdbc version 3.46.1.3

Solution:
File SQLiteJDBCLoader:
Code:

                logger.error(
                        "Failed to load native library: {}. osinfo: {}",
                        name,
                        OSInfo.getNativeLibFolderPathForCurrentOS(),
                        e);

To change:

                logger.error(
                        "Failed to load native library: {0}. osinfo: {1}",
                        name,
                        OSInfo.getNativeLibFolderPathForCurrentOS(),
                        e);

And code:

LoggerFactory.getLogger(VersionHolder.class)
                        .error("Could not read version from file: {}", versionFile, e);

To change:

LoggerFactory.getLogger(VersionHolder.class)
                        .error("Could not read version from file: {0}", versionFile, e);
@ulm-su ulm-su added the triage label Oct 13, 2024
@gotson
Copy link
Collaborator

gotson commented Oct 14, 2024

seems to be an issue with JUL, the format of java.text.MessageFormat is different than the one from SLF4J

@gotson gotson added bug Something isn't working and removed triage labels Oct 14, 2024
@gotson gotson closed this as completed in fd21058 Oct 14, 2024
Copy link
Contributor

🎉 This issue has been resolved in 3.47.0.0 (Release Notes)

@github-actions github-actions bot added the released Issue has been released label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Issue has been released
Projects
None yet
Development

No branches or pull requests

2 participants