Skip to content

forcing a 0-size update batch causes division by zero in wikidata-update #226

@pfps

Description

@pfps

I interrupted wikidata-update (twice) and that appears to have tried to send off a zero-size batch, which caused a division by zero.

getafix scripts> qlever update-wikidata --host-name localhost --port 7001 --access-token ""

To enable autocompletion, run the following command, and consider adding it to your `.bashrc` or `.zshrc`:

eval "$(register-python-argcomplete qlever)" && export QLEVER_ARGCOMPLETE_ENABLED=1

Invoking command `update-wikidata` without a Qleverfile. You have to specify all required arguments on the command line. This is possible, but not recommended.

Command: update-wikidata

SINCE=$(curl -s http://localhost:7001 -H "Accept: text/csv" -H "Content-type: application/sparql-query" --data "PREFIX wikibase: <http://wikiba.se/ontology#> PREFIX schema: <http://schema.org/> SELECT * WHERE { { SELECT (MIN(?date_modified) AS ?updates_complete_until) { wikibase:Dump schema:dateModified ?date_modified } } UNION { wikibase:Dump wikibase:updatesCompleteUntil ?updates_complete_until } } ORDER BY DESC(?updates_complete_until) LIMIT 1" | sed 1d)
Process SSE stream from https://stream.wikimedia.org/v2/stream/rdf-streaming-updater.mutation.v2?since=$SINCE in batches of 100,000 messages (less if a message is encountered that is within 1 second of the current time)

Press Ctrl+C to finish the current batch and end gracefully, press Ctrl+C again to continue with the next batch

SINCE=2025-11-24T23:03:51Z

Ctrl+C pressed, will finish the current batch and then exit [press Ctrl+C again to continue]
Processing batch #1 with 37,399 messages, date range: 2025-11-24T23:03:51Z - 2025-11-25T01:43:53Z  [assembly time: 18,097 ms, min delta to NOW: 1,336,238 s]
curl -s -X POST http://localhost:7001 -H 'Authorization: Bearer ' -H 'Content-Type: application/sparql-update' --data-binary @update.sparql.1
Error parsing JSON result: Expecting value: line 1 column 1 (char 0), the first 1000 characters are:
Authorization header doesn't start with "Bearer ".

Waiting 3600 seconds before processing the next batch

An unexpected error occurred: float division by zero

Traceback (most recent call last):
  File "/home/pfps/.local/lib/python3.13/site-packages/qlever/qlever_main.py", line 38, in main
    command_successful = command_object.execute(args)
  File "/home/pfps/.local/lib/python3.13/site-packages/qlever/commands/update_wikidata.py", line 567, in execute
    time_us_per_op = int(1e6 * total_time_s / total_num_ops)
                         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
ZeroDivisionError: float division by zero

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