high-optician-2097
swift-secretary-83973
10/12/2020, 10:47 AMhigh-optician-2097
swift-secretary-83973
10/12/2020, 12:28 PMhigh-optician-2097
high-optician-2097
swift-secretary-83973
10/12/2020, 12:29 PMswift-secretary-83973
10/12/2020, 12:30 PMswift-secretary-83973
10/12/2020, 12:30 PMswift-secretary-83973
10/12/2020, 12:31 PMswift-secretary-83973
10/12/2020, 12:33 PMhigh-optician-2097
high-optician-2097
high-optician-2097
high-optician-2097
high-optician-2097
high-optician-2097
swift-secretary-83973
10/12/2020, 12:38 PMhigh-optician-2097
steep-lamp-91158
steep-lamp-91158
steep-lamp-91158
swift-secretary-83973
10/12/2020, 2:28 PMhigh-optician-2097
swift-secretary-83973
10/12/2020, 3:39 PMswift-secretary-83973
10/13/2020, 8:07 AMtime=2020-10-13T07:44:19Z level=error msg=An error occurred audience=application error=map[message:ERROR: column "id" of relation "hydra_oauth2_authentication_request" does not exist (SQLSTATE 42703)] http_request=map[headers:map[accept:*/* user-agent:python-requests/2.24.0 x-forwarded-for:192.168.1.23,100.100.33.64 x-forwarded-proto:https x-request-id:821c3dff-51a2-47e2-b7e6-f8b83d52c47f] host:<http://szilard-stange.devtenant.strivacity.com|szilard-stange.devtenant.strivacity.com> method:GET path:/oauth2/auth query:Value is sensitive and has been redacted. To see the value set config key "log.leak_sensitive_values = true" or environment variable "LOG_LEAK_SENSITIVE_VALUES=true". remote:127.0.0.1:50002 scheme:http]
b) then I've started this new version with a clean psql database which resulted the following
time=2020-10-13T07:54:08Z level=warning msg=JSON Web Key Set "hydra.openid.id-token" does not exist yet, generating new key pair... audience=application service_name= service_version=
time=2020-10-13T07:54:09Z level=fatal msg=Could not ensure that signing keys for "hydra.openid.id-token" exists. If you are running against a persistent SQL database this is most likely because your "secrets.system" ("SECRETS_SYSTEM" environment variable) is not set or changed. When running with an SQL database backend you need to make sure that the secret is set and stays the same, unless when doing key rotation. This may also happen when you forget to run "hydra migrate sql".. audience=application error=map[message:Could not persist JSON Web Key Set "hydra.openid.id-token".: ERROR: column "id" does not exist (SQLSTATE 42703)] service_name= service_version=
SECRETS_SYSTEM is set and haven't changed
Did I miss something or made a mistake on my side (which is possible of course 🙂 ) or is there an issue on this branch?high-optician-2097
high-optician-2097
hydra_1 | time=2020-10-13T08:13:49Z level=info msg=Jaeger tracer configured! audience=application service_name= service_version=
hydra_1 | time=2020-10-13T08:13:49Z level=warning msg=JSON Web Key Set "hydra.openid.id-token" does not exist yet, generating new key pair... audience=application service_name= service_version=
postgresd_1 | ERROR: syntax error at or near "," at character 85
postgresd_1 | STATEMENT: INSERT INTO "hydra_jwk" ("created_at", "keydata", "kid", "sid", "version") VALUES (?, ?, ?, ?, ?) returning pk
hydra_1 | time=2020-10-13T08:13:55Z level=fatal msg=Could not ensure that signing keys for "hydra.openid.id-token" exists. If you are running against a persistent SQL database this is most likely because your "secrets.system" ("SECRETS_SYSTEM" environment variable) is not set or changed. When running with an SQL database backend you need to make sure that the secret is set and stays the same, unless when doing key rotation. This may also happen when you forget to run "hydra migrate sql".. audience=application error=map[message:Could not persist JSON Web Key Set "hydra.openid.id-token".: ERROR: syntax error at or near "," (SQLSTATE 42601)] service_name= service_version=swift-secretary-83973
10/13/2020, 8:37 AMhigh-optician-2097
high-optician-2097
swift-secretary-83973
10/13/2020, 12:13 PMswift-secretary-83973
10/13/2020, 12:57 PMsteep-lamp-91158
swift-secretary-83973
10/13/2020, 1:59 PMsteep-lamp-91158
swift-secretary-83973
10/13/2020, 2:27 PMsteep-lamp-91158
high-optician-2097
swift-secretary-83973
10/14/2020, 8:58 AMsteep-lamp-91158
high-optician-2097
steep-lamp-91158
steep-lamp-91158
swift-secretary-83973
10/15/2020, 9:48 AMswift-secretary-83973
10/15/2020, 9:49 AMsteep-lamp-91158
steep-lamp-91158
swift-secretary-83973
10/15/2020, 1:28 PMswift-secretary-83973
10/15/2020, 2:20 PMPUT /oauth2/auth/requests/consent/accept request details. It took 285ms to serve.
From this 285ms
* ~57ms spent in handler.goAcceptConsentRequest cr, err := h.r.ConsentManager().GetConsentRequest(r.Context(), challenge)
* ~227ms spent in handler.goAcceptConsentRequest hr, err := h.r.ConsentManager().HandleConsentRequest(r.Context(), challenge, &p)
Further checking h.r.ConsentManager().HandleConsentRequest(r.Context(), challenge, &p) call in persister_consent.goHandleConsentRequest
The ~227ms composed from these items:
* ~180ms spent in err := sqlcon.HandleError(c.Create(r))
* ~26ms in return p.GetConsentRequest(ctx, challenge)
and here is the relevant SQL side log for Create:
2020-10-15T14:01:32+02:00 {} 2020-10-15 12:01:32.031 GMT [12139] LOG: duration: 0.083 ms bind pgx_3707: INSERT INTO "hydra_oauth2_consent_request_handled" ("authenticated_at", "challenge", "error", "granted_at_audience", "granted_scope", "handled_at", "remember", "remember_for", "requested_at", "session_access_token", "session_id_token", "was_used") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
2020-10-15T14:01:32+02:00 {} 2020-10-15 12:01:32.031 GMT [12139] DETAIL: parameters: $1 = NULL, $2 = 'f73dbf2e65ef4c229aaed81b301de9d6', $3 = '{}', $4 = '', $5 = 'openid', $6 = '2020-10-15 12:01:31.96667', $7 = 'f', $8 = '0', $9 = '2020-10-15 12:01:26.391577', $10 = 'null', $11 = '{"client_id":"d57cf01c0bfb4be5a40c211ec58db421","user_id":"2628deb7-2ee4-43f7-a4c8-a7134e798fc4","username":"bd87645d"}', $12 = 'f'
2020-10-15T14:01:32+02:00 {} 2020-10-15 12:01:32.031 GMT [12139] LOG: duration: 0.126 ms execute pgx_3707: INSERT INTO "hydra_oauth2_consent_request_handled" ("authenticated_at", "challenge", "error", "granted_at_audience", "granted_scope", "handled_at", "remember", "remember_for", "requested_at", "session_access_token", "session_id_token", "was_used") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
2020-10-15T14:01:32+02:00 {} 2020-10-15 12:01:32.031 GMT [12139] DETAIL: parameters: $1 = NULL, $2 = 'f73dbf2e65ef4c229aaed81b301de9d6', $3 = '{}', $4 = '', $5 = 'openid', $6 = '2020-10-15 12:01:31.96667', $7 = 'f', $8 = '0', $9 = '2020-10-15 12:01:26.391577', $10 = 'null', $11 = '{"client_id":"d57cf01c0bfb4be5a40c211ec58db421","user_id":"2628deb7-2ee4-43f7-a4c8-a7134e798fc4","username":"bd87645d"}', $12 = 'f'
So that SQL side seems fast and it lost the remaining eg. ~179ms somewhere between... (the flow includes other services also and I didn't experience such huge response time between other services just between Hydra's Create call and PostgreSQL db)
Do you have a quick idea how can I make sure that it uses connection pooling? I've configured that via DSN but not using connection pooling could easily explain that response time.steep-lamp-91158
swift-secretary-83973
10/15/2020, 3:41 PMswift-secretary-83973
10/15/2020, 3:48 PMsteep-lamp-91158
high-optician-2097
swift-secretary-83973
10/16/2020, 7:43 AMhigh-optician-2097
high-optician-2097
high-optician-2097
sqlx simply fails to detect what database type we’re dealing with because the driver name is instrumented-postgres . That causes sqlx.Rebind to fail which would usually translate ? to $1 SQL argumentsswift-secretary-83973
10/16/2020, 7:59 AMhigh-optician-2097
swift-secretary-83973
10/16/2020, 8:11 AMhigh-optician-2097
swift-secretary-83973
10/16/2020, 1:02 PMhigh-optician-2097
high-optician-2097
swift-secretary-83973
10/16/2020, 1:11 PMpostgres://<redacted>:5432/hydra?sslmode=disable&max_conns=50&max_idle_conns=10&max_conn_lifetime=1h -> sql-next produces sligtly longer response times
postgres://<redacted>:5432/hydra?sslmode=disable&max_conns=50&max_idle_conns=50&max_conn_lifetime=1h -> perf of master and sql-next seems the same
postgres://<redacted>:5432/hydra?sslmode=disable&max_conns=200&max_idle_conns=200&max_conn_lifetime=1h -> perf of master and sql-next seems the same IF PostgreSQL has at least 200 free connection. If PostgreSQL side there is only ~190 free connection then sql-next branch produces a slightly longer response times compared to master.high-optician-2097
high-optician-2097
make docker; docker tag oryd/hydra:latest-sqlite oryd/hydra:v1.8.5; docker tag oryd/hydra:latest-sqlite oryd/hydra:v1.8.5-sqlite
docker-compose -f quickstart.yml -f quickstart-tracing.yml -f quickstart-postgres.yml uphigh-optician-2097