Token not found
Symptoms
File versions (previews as well as large versions like
hugeandfull) sporadically fail to produce. Metadata extraction may fail as well.The file worker and the events (
FILE_PRODUCE_ERROR) show errors like:
"Error": "Token not found"metadata read: unable to run file metadata job: ...The errors correlate with load: the more file production is going on, the more of them appear.
A manual resync of the affected versions (for example via
/inspect/files) usually succeeds.
Cause
fylr sends every job to the execserver in two steps: GET /token/{service} reserves a worker slot and answers with a one-time token, then PUT /job/{service} sends the job presenting that token. The token is valid for 10 seconds and is held in the memory of the execserver process that issued it.
Token not found means the job request arrived at an execserver process that does not hold the token:
Most common: several execserver instances run behind a single load-balanced address (for example a Kubernetes Service), and the token and job requests were routed to different instances. A per-connection load balancer keeps both on one instance only as long as fylr reuses the connection; under parallel load requests get fresh connections.
The execserver restarted between the two requests (crash, out-of-memory kill, redeployment). Tokens do not survive a restart. Check the restart count of the execserver container/pod.
Rarely: more than 10 seconds passed between the two requests (extreme overload of the machine or the network).
Solutions
If several execserver instances run behind one load balancer: set
tokenResponseSendServerIPon each instance to its own, directly reachable IP address. The token response then carries that address, and fylr sends the job straight to the instance that issued the token; the next token request goes through the balanced address again.
In Kubernetes, inject the pod IP via the downward API in the execserver deployment. The fylr pods must reach the execserver pod IPs directly on the execserver port.
Alternatively, skip the load balancer and list every execserver instance individually in
fylr.execserver.addresses— fylr then balances by itself.If the errors coincide with execserver restarts, solve the restarts (memory limits, timeouts) first.
To verify the routing, set the fylr server log level to
traceand search the log forConnection to execserver: the token request and the following job request of the same job must show the sameRemoteAddr.
Last updated