Dovecot version: 2.3.20
 
Dear Colleagues!
passdb is set to oauth2 and userdb is set to sql. On attempt of authorization a fatal error is rising. The case reproducible 100%. The following suggested configuration files allow you to reproduce the case.
Thank you!
 
dovecot.conf
```
protocols = imap
auth_mechanisms = plain xoauth2 oauthbearer
disable_plaintext_auth = no
 
passdb {
  driver = oauth2
  mechanisms = xoauth2 oauthbearer
  args = /etc/dovecot/oauth2.conf.ext
}
 
userdb {
  driver = sql
  args = /etc/dovecot/userdb.conf.ext
}
 
mail_home=/home/test/%Lu
mail_location=sdbox:~/Mail
 
namespace {
  inbox = yes
  separator = /
}
```
 
/etc/dovecot/oauth2.conf.ext
```
introspection_mode = post
introspection_url = https://admin:admin@authserver:9443/oauth2/introspect
username_attribute = username
active_attribute = active
active_value = true
tls_allow_invalid_cert = yes
```
 
/etc/dovecot/userdb.conf.ext
```
driver = pgsql
connect = host=dbhost port=5432 dbname=test user=test password=test
user_query = SELECT 'something' AS something
```
 
Error log:
```
Jul 18 13:04:51 mail01 dovecot: auth: Panic: file http-client.c: line 646 (http_client_context_close): assertion failed: (cctx->clients_list == NULL)
Jul 18 13:04:51 mail01 dovecot: auth: Error: Raw backtrace: /usr/lib/dovecot/libdovecot.so.0(backtrace_append+0x3d) [0x733f846a085d] -> /usr/lib/dovecot/libdovecot.so.0(backtrace_get+0x1e) [0x733f846a097e] -> /usr/lib/dovecot/libdovecot.so.0(+0x10091b) [0x733f846ad91b] -> /usr/lib/dovecot/libdovecot.so.0(+0x1009b1) [0x733f846ad9b1] -> /usr/lib/dovecot/libdovecot.so.0(+0x54b7c) [0x733f84601b7c] -> /usr/lib/dovecot/libdovecot.so.0(+0x4d208) [0x733f845fa208] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_set_current+0x75) [0x733f846c2ca5] -> /usr/lib/dovecot/modules/auth/libdriver_pgsql.so(+0x4686) [0x733f842d7686] -> /usr/lib/dovecot/modules/auth/libdriver_pgsql.so(+0x49b7) [0x733f842d79b7] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x69) [0x733f846c3e59] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0x131) [0x733f846c5481] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x4c) [0x733f846c3efc] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_run+0x40) [0x733f846c4080] -> /usr/lib/dovecot/modules/auth/libdriver_pgsql.so(+0x57ec) [0x733f842d87ec] -> /usr/lib/dovecot/modules/auth/libdriver_pgsql.so(+0x405b) [0x733f842d705b] -> dovecot/auth(+0x4728b) [0x5a35cac1128b] -> dovecot/auth(+0x36ca1) [0x5a35cac00ca1] -> dovecot/auth(userdb_init+0x1a) [0x5a35cabfe70a] -> dovecot/auth(auths_init+0xc9) [0x5a35cabdfce9] -> dovecot/auth(main+0x398) [0x5a35cabdeb78] -> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x733f8435b09b] -> dovecot/auth(_start+0x2a) [0x5a35cabded8a]
Jul 18 13:04:51 mail01 dovecot: master: Error: service(auth): command startup failed, throttling for 32.000 secs
Jul 18 13:04:51 mail01 dovecot: auth: Fatal: master: service(auth): child 32434 killed with signal 6 (core dumps disabled - https://dovecot.org/bugreport.html#coredumps)
```