Skip to content

[Usage] workspace.go:68 Error 1390: Prepared statement contains too many placeholders #10642

@jankeromnes

Description

@jankeromnes

Bug description

It looks like our usage component is logging an error containing tons of workspace IDs once every minute:

github.com/gitpod-io/gitpod/usage/pkg/db/workspace.go:68 Error 1390: Prepared statement contains too many placeholders\n[140.200ms] [rows:0] SELECT * FROM `d_b_workspace` WHERE `d_b_workspace`.`id` IN ('techlabapps-myjourney-mysicp2zuyi','antdesign-antdesign-j3ad1xm6oqt',.........

I believe the problem arises here:

workspaces, err := db.ListWorkspacesByID(ctx, u.conn, toSet(workspaceIDs))

when we try to get all the workspaces corresponding to all the workspace instances which ran some time this month.

Reminder: Gitpod runs tons of workspaces and instances each month. We should be careful when querying them all into memory and/or dumping them all into logs. (And, currently, the usage component does both every minute.)

See also:

Steps to reproduce

  1. Check usage component logs in production

Workspace affected

No response

Expected behavior

No response

Example repository

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

team: webappIssue belongs to the WebApp teamtype: bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions