Session resumption randomly fails

Description of problem:

When using gnutls client, it randomly fails to resume session against both NSS and OpenSSL servers.

Version of gnutls used:

gnutls-3.6.5-2.el8

Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)

RHEL

How reproducible:

Steps to Reproduce:

  • set up NSS or OpenSSL server with TLS 1.3 support
  • connect to them using gnutls-cli --resume
  • look for presence of both Resume Handshake was completed and This is a resumed session

Actual results:

the This is a resumed session is sometimes missing, in case of OpenSSL, it also notes that it's a New, TLSv1.3 session

Expected results:

all connections should be able to resume