workers-sdk
workers-sdk copied to clipboard
Bulk putting big JSON file with malformed records burns the CPU
What versions & operating system are you using?
Wrangler 4.19.1, macOS Sequoia 15.5, Node 20.16.0, aarch64
Please provide a link to a minimal reproduction
No response
Describe the Bug
Putting a big JSON file with malformed records using bulk put will freeze the Wrangler when it's supposed to crash or print out the error log (same symptoms for both local and remote), I have to SIGTERM to stop the process:
If I keep the process running, it will burns the CPU up, makes my MacBook Air get super hot shortly after (90-100 DegC), which doesn't make any sense.
To generate a malformed record, please use this script:
import json
import uuid
import random
record_count = 500000
json_data = [{
# malformed key
"key": random.randint(1, record_count),
# random bogus value
"value": uuid.uuid4().hex + uuid.uuid4().hex + uuid.uuid4().hex + uuid.uuid4().hex
} for _ in range(record_count)]
with open('test.json', 'w') as f:
json.dump(json_data, f)
then use the test.json generated above with bulk put command:
npx wrangler kv bulk put --namespace-id SOME_NAMESPACE ./test.json
Please provide any relevant error logs
No response