Skip to content

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

@mrigger

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.

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