← 输入框|github.com|刷新
Skip to content

SQLancer fails to load providers when using a newer JVM #799

Open

Description

@mrigger

When using SQLancer with the JVM below (e.g., using a command such as java -jar sqlancer-2.0.0.jar duckdb), everything seems to work fine.

openjdk 11.0.18 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

If I now use the JVM below, I get a ParameterException as shown further below.

openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode)

Edit: This is the JDK used by the latest Eclipse, to which I imported SQLancer as a Maven project. Perhaps the issue could be environment-specific.

Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter 'duckdb' but no main parameter was defined in your arg class
	at com.beust.jcommander.JCommander.initMainParameterValue(JCommander.java:961)
	at com.beust.jcommander.JCommander.parseValues(JCommander.java:762)
	at com.beust.jcommander.JCommander.parse(JCommander.java:363)
	at com.beust.jcommander.JCommander.parse(JCommander.java:342)
	at sqlancer.Main.executeMain(Main.java:467)
	at sqlancer.Main.main(Main.java:296)

This seems related to the ServiceLoader that we are using. Starting SQLancer with no options (java -jar sqlancer-2.0.0.jar) shows that no providers were loaded since only general options are shown:

Usage: SQLancer [options]
  Options:
    --constant-cache-size
      Specifies the size of the constant cache. This option only takes effect 
      when constant caching is enabled
      Default: 100
    --database-prefix
      The prefix used for each database created
      Default: database
...
    --use-constant-caching
      Specifies whether constants should be cached and re-used with a certain 
      probability 
      Default: true
    --use-reducer
      EXPERIMENTAL Attempt to reduce queries using a simple reducer
      Default: false
    --username
      The user name used to log into the DBMS
      Default: sqlancer

A workaround is to use an older Java version (e.g., Java 11). Another workaround would be to manually add the providers. For example, above line 612 in the main class (see

return providers;
), a DuckDB provider could be added using providers.add(new DuckDBProvider());. Neither is a satisfactory long-term solution, so we should fix this.

Activity

  1. oraluben commented on Jun 7, 2023

    @oraluben
    Collaborator

    Was this happening when launching sqlancer in Eclipse?

  2. mrigger commented on Jun 7, 2023

    @mrigger
    ContributorAuthor

    Yes, I've updated the issue description already.

  3. oraluben commented on Jun 7, 2023

    @oraluben
    Collaborator

    Sounds like that Eclipse's inserted some debug/diagnosis args. What's the actual arguments that the main function get?

  4. mrigger commented on Jun 7, 2023

    @mrigger
    ContributorAuthor

    Here is the full command line for WSL+Ubuntu (I can also reproduce this on Ubuntu directly).

    C:\Users\rigger\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20221004-1257\jre\bin\javaw.exe
    -Dfile.encoding=UTF-8
    -classpath "\\WSL.LOCALHOST\Ubuntu\home\manuel\sqlancer\target\test-classes;\\WSL.LOCALHOST\Ubuntu\home\manuel\sqlancer\target\classes;C:\Users\rigger\.p2\pool\plugins\junit-jupiter-api_5.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-jupiter-engine_5.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-jupiter-migrationsupport_5.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-jupiter-params_5.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-commons_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-engine_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-launcher_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-runner_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-suite-api_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-suite-engine_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-platform-suite-commons_1.9.2.jar;C:\Users\rigger\.p2\pool\plugins\junit-vintage-engine_5.9.2.jar;C:\Users\rigger\.p2\pool\plugins\org.opentest4j_1.2.0.jar;C:\Users\rigger\.p2\pool\plugins\org.apiguardian.api_1.1.2.jar;C:\Users\rigger\.p2\pool\plugins\org.junit_4.13.2.v20211018-1956.jar;C:\Users\rigger\.p2\pool\plugins\org.hamcrest.core_1.3.0.v20180420-1519.jar;C:\Users\rigger\.m2\repository\com\google\auto\service\auto-service\1.0.1\auto-service-1.0.1.jar;C:\Users\rigger\.m2\repository\com\google\auto\service\auto-service-annotations\1.0.1\auto-service-annotations-1.0.1.jar;C:\Users\rigger\.m2\repository\com\google\auto\auto-common\1.2\auto-common-1.2.jar;C:\Users\rigger\.m2\repository\com\google\guava\guava\31.0.1-jre\guava-31.0.1-jre.jar;C:\Users\rigger\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\rigger\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\rigger\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\rigger\.m2\repository\com\google\errorprone\error_prone_annotations\2.7.1\error_prone_annotations-2.7.1.jar;C:\Users\rigger\.m2\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;C:\Users\rigger\.m2\repository\com\beust\jcommander\1.82\jcommander-1.82.jar;C:\Users\rigger\.m2\repository\org\postgresql\postgresql\42.5.1\postgresql-42.5.1.jar;C:\Users\rigger\.m2\repository\org\checkerframework\checker-qual\3.5.0\checker-qual-3.5.0.jar;C:\Users\rigger\.m2\repository\com\ing\data\cassandra-jdbc-wrapper\4.7.0\cassandra-jdbc-wrapper-4.7.0.jar;C:\Users\rigger\.m2\repository\com\datastax\oss\java-driver-core\4.14.1\java-driver-core-4.14.1.jar;C:\Users\rigger\.m2\repository\com\datastax\oss\native-protocol\1.5.1\native-protocol-1.5.1.jar;C:\Users\rigger\.m2\repository\io\netty\netty-handler\4.1.75.Final\netty-handler-4.1.75.Final.jar;C:\Users\rigger\.m2\repository\io\netty\netty-common\4.1.75.Final\netty-common-4.1.75.Final.jar;C:\Users\rigger\.m2\repository\io\netty\netty-resolver\4.1.75.Final\netty-resolver-4.1.75.Final.jar;C:\Users\rigger\.m2\repository\io\netty\netty-buffer\4.1.75.Final\netty-buffer-4.1.75.Final.jar;C:\Users\rigger\.m2\repository\io\netty\netty-transport\4.1.75.Final\netty-transport-4.1.75.Final.jar;C:\Users\rigger\.m2\repository\io\netty\netty-codec\4.1.75.Final\netty-codec-4.1.75.Final.jar;C:\Users\rigger\.m2\repository\com\datastax\oss\java-driver-shaded-guava\25.1-jre-graal-sub-1\java-driver-shaded-guava-25.1-jre-graal-sub-1.jar;C:\Users\rigger\.m2\repository\com\typesafe\config\1.4.1\config-1.4.1.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jnr-posix\3.1.15\jnr-posix-3.1.15.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jnr-ffi\2.2.11\jnr-ffi-2.2.11.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jffi\1.3.9\jffi-1.3.9.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jffi\1.3.9\jffi-1.3.9-native.jar;C:\Users\rigger\.m2\repository\org\ow2\asm\asm\9.2\asm-9.2.jar;C:\Users\rigger\.m2\repository\org\ow2\asm\asm-commons\9.2\asm-commons-9.2.jar;C:\Users\rigger\.m2\repository\org\ow2\asm\asm-analysis\9.2\asm-analysis-9.2.jar;C:\Users\rigger\.m2\repository\org\ow2\asm\asm-tree\9.2\asm-tree-9.2.jar;C:\Users\rigger\.m2\repository\org\ow2\asm\asm-util\9.2\asm-util-9.2.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jnr-a64asm\1.0.0\jnr-a64asm-1.0.0.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jnr-x86asm\1.0.2\jnr-x86asm-1.0.2.jar;C:\Users\rigger\.m2\repository\com\github\jnr\jnr-constants\0.10.3\jnr-constants-0.10.3.jar;C:\Users\rigger\.m2\repository\io\dropwizard\metrics\metrics-core\4.1.18\metrics-core-4.1.18.jar;C:\Users\rigger\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;C:\Users\rigger\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;C:\Users\rigger\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.13.2.2\jackson-databind-2.13.2.2.jar;C:\Users\rigger\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;C:\Users\rigger\.m2\repository\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;C:\Users\rigger\.m2\repository\com\github\stephenc\jcip\jcip-annotations\1.0-1\jcip-annotations-1.0-1.jar;C:\Users\rigger\.m2\repository\com\github\spotbugs\spotbugs-annotations\3.1.12\spotbugs-annotations-3.1.12.jar;C:\Users\rigger\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;C:\Users\rigger\.m2\repository\com\yugabyte\jdbc-yugabytedb\42.3.5-yb-1\jdbc-yugabytedb-42.3.5-yb-1.jar;C:\Users\rigger\.m2\repository\org\xerial\sqlite-jdbc\3.40.0.0\sqlite-jdbc-3.40.0.0.jar;C:\Users\rigger\.m2\repository\mysql\mysql-connector-java\8.0.30\mysql-connector-java-8.0.30.jar;C:\Users\rigger\.m2\repository\com\google\protobuf\protobuf-java\3.19.4\protobuf-java-3.19.4.jar;C:\Users\rigger\.m2\repository\org\mariadb\jdbc\mariadb-java-client\3.1.0\mariadb-java-client-3.1.0.jar;C:\Users\rigger\.m2\repository\com\github\waffle\waffle-jna\3.2.0\waffle-jna-3.2.0.jar;C:\Users\rigger\.m2\repository\net\java\dev\jna\jna\5.12.1\jna-5.12.1.jar;C:\Users\rigger\.m2\repository\net\java\dev\jna\jna-platform\5.12.1\jna-platform-5.12.1.jar;C:\Users\rigger\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.36\jcl-over-slf4j-1.7.36.jar;C:\Users\rigger\.m2\repository\com\github\ben-manes\caffeine\caffeine\2.9.3\caffeine-2.9.3.jar;C:\Users\rigger\.m2\repository\org\duckdb\duckdb_jdbc\0.5.1\duckdb_jdbc-0.5.1.jar;C:\Users\rigger\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.9.1\junit-jupiter-engine-5.9.1.jar;C:\Users\rigger\.m2\repository\org\junit\platform\junit-platform-engine\1.9.1\junit-platform-engine-1.9.1.jar;C:\Users\rigger\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\rigger\.m2\repository\org\junit\platform\junit-platform-commons\1.9.1\junit-platform-commons-1.9.1.jar;C:\Users\rigger\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.9.1\junit-jupiter-api-5.9.1.jar;C:\Users\rigger\.m2\repository\org\apiguardian\apiguardian-api\1.1.2\apiguardian-api-1.1.2.jar;C:\Users\rigger\.m2\repository\org\slf4j\slf4j-simple\2.0.6\slf4j-simple-2.0.6.jar;C:\Users\rigger\.m2\repository\org\slf4j\slf4j-api\2.0.6\slf4j-api-2.0.6.jar;C:\Users\rigger\.m2\repository\ru\yandex\clickhouse\clickhouse-jdbc\0.3.2\clickhouse-jdbc-0.3.2.jar;C:\Users\rigger\.m2\repository\com\clickhouse\clickhouse-http-client\0.3.2\clickhouse-http-client-0.3.2.jar;C:\Users\rigger\.m2\repository\com\clickhouse\clickhouse-client\0.3.2\clickhouse-client-0.3.2.jar;C:\Users\rigger\.m2\repository\com\google\code\gson\gson\2.8.8\gson-2.8.8.jar;C:\Users\rigger\.m2\repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;C:\Users\rigger\.m2\repository\org\apache\httpcomponents\httpcore\4.4.13\httpcore-4.4.13.jar;C:\Users\rigger\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\rigger\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\rigger\.m2\repository\org\apache\httpcomponents\httpmime\4.5.13\httpmime-4.5.13.jar;C:\Users\rigger\.m2\repository\org\lz4\lz4-java\1.8.0\lz4-java-1.8.0.jar;C:\Users\rigger\.m2\repository\com\h2database\h2\2.1.214\h2-2.1.214.jar;C:\Users\rigger\.m2\repository\org\mongodb\mongodb-driver-sync\4.1.1\mongodb-driver-sync-4.1.1.jar;C:\Users\rigger\.m2\repository\org\mongodb\bson\4.1.1\bson-4.1.1.jar;C:\Users\rigger\.m2\repository\org\mongodb\mongodb-driver-core\4.1.1\mongodb-driver-core-4.1.1.jar;C:\Users\rigger\.m2\repository\com\arangodb\arangodb-java-driver\6.9.0\arangodb-java-driver-6.9.0.jar;C:\Users\rigger\.m2\repository\com\arangodb\velocypack\2.5.1\velocypack-2.5.1.jar;C:\Users\rigger\.m2\repository\org\questdb\questdb\6.5.3\questdb-6.5.3.jar;C:\Users\rigger\.m2\repository\org\hsqldb\hsqldb\2.7.1\hsqldb-2.7.1.jar;C:\Users\rigger\.m2\repository\org\apache\commons\commons-csv\1.9.0\commons-csv-1.9.0.jar"
    -XX:+ShowCodeDetailsInExceptionMessages sqlancer.Main
    --num-threads 4
    --num-queries 1000 duckdb
    --oracle WHERE
    
  5. oraluben commented on Jun 7, 2023

    @oraluben
    Collaborator

    as in #800 (review),

    sqlancer doesn't work well when integrated with IntelliJ Idea as well. Might need further work on IDE integration.

    Here's information in Idea:

    /Users/yyc/repo/db/sqlancer/src/sqlancer/mariadb/gen/MariaDBSetGenerator.java:38:60
    java: The method fromOptions(T...) of type sqlancer.Randomly is not applicable as the formal varargs element type T is not accessible here
    
  6. isaacchua commented on Aug 13, 2025

    @isaacchua

    I tried to reproduce the problem with Temurin 17.0.6+10 but it didn't occur (see the logs below). I don't think the issue is caused by Temurin 17.0.6+10 per se.

    user@f6686f6f9753:/test$ java --version
    openjdk 17.0.6 2023-01-17
    OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
    OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
    user@f6686f6f9753:/test$ java -jar sqlancer.jar
    Usage: SQLancer [options] [command] [command options]
      Options:
        --ast-reducer-max-steps
          EXPERIMENTAL Maximum steps the AST-based reducer will do
          Default: -1
        --ast-reducer-max-time
          EXPERIMENTAL Maximum time duration (secs) the statement reducer will do
          Default: -1
    [...]
      Commands:
        citus      PostgreSQL (default port: 5432, default host: localhost)
          Usage: citus [options]
            Options:
              --bulk-insert
                Specifies whether INSERT statements should be issued in bulk
                Default: false
              --citusoracle
                Specifies which test oracle should be used for Citus extension to
                PostgreSQL
                Default: [QUERY_PARTITIONING]
    [...]
        ysql      YSQL (default port: 5433, default host: localhost
          Usage: ysql [options]
            Options:
              --bulk-insert
                Specifies whether INSERT statements should be issued in bulk
                Default: false
              --connection-url
                Specifies the URL for connecting to the YSQL server
                Default: jdbc:yugabytedb://localhost:5433/yugabyte
              --oracle
                Specifies which test oracle should be used for YSQL
                Default: [QUERY_PARTITIONING]
              --test-collations
                Specifies whether to test different collations
                Default: true
    

    Here is what I did:

    1. Save the following Dockerfile into the local SQLancer repository as jvm17.dockerfile:
    FROM ubuntu:22.04
    
    ARG USER=user
    
    ENV WORKDIR=/test
    WORKDIR $WORKDIR
    
    COPY ./jvm/*.tar.gz jvm/
    COPY ./target/sqlancer-*.jar sqlancer.jar
    COPY ./target/lib/*.jar lib/
    
    RUN <<EOF
    /bin/bash -c '
    mkdir -p jvm/ext/
    for archive in jvm/*.tar.gz; do
      tar -xf $archive -C jvm/ext/
    done
    shopt -s nullglob
    directories=($WORKDIR/jvm/ext/*)
    for i in ${!directories[@]}; do
      directory=${directories[i]}
      update-alternatives --install /usr/bin/java java "${directory}/bin/java" $i
    done
    addgroup $USER && adduser --ingroup $USER --disabled-password -q $USER
    chown -R $USER:$USER $WORKDIR
    '
    EOF
    
    USER $USER
    
    1. Download Temurin (current working directory is the SQLancer repository):
    mkdir jvm
    curl -fOL --output-dir jvm https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6%2B10/OpenJDK17U-jre_x64_linux_hotspot_17.0.6_10.tar.gz
    
    1. Build SQLancer:
    mvn clean package -DskipTests=true
    
    1. Build the Dockerfile with docker or podman:
    podman build -t sqlancer-jvm17 -f jvm17.dockerfile .
    
    1. Start the container interactively:
    podman run --rm -it sqlancer-jvm17:latest /bin/bash
    
    1. Run Java and SQLancer:
    java --version
    java -jar sqlancer.jar
    
  7. isaacchua commented on Aug 13, 2025

    @isaacchua

    To be clear, the issue 799 error was not seen:

    No DBMS implementations (i.e., instantiations of the DatabaseProvider class) were found. You likely ran into an issue described in https://github.com/sqlancer/sqlancer/issues/799. As a workaround, I now statically load all supported providers as of June 7, 2023.
    

    Which means that the DatabaseProvider classes loaded with the ServiceLoader as expected.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions