[
https://issues.apache.org/jira/browse/CASSANDRA-19165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18055767#comment-18055767
]
Dmitry Konstantinov commented on CASSANDRA-19165:
-------------------------------------------------
ok, I think the root cause is the following. As a part of the test setup we
create users used later in the tests:
{code:java}
executeAs(Arrays.asList("CREATE ROLE testuser WITH LOGIN = true AND SUPERUSER =
false AND PASSWORD = 'foo'",
"CREATE ROLE testuser_nologin WITH LOGIN = false AND
SUPERUSER = false AND PASSWORD = 'foo'",
"CREATE KEYSPACE testks WITH replication = {'class':
'SimpleStrategy', 'replication_factor': '1'}",
"CREATE TABLE testks.table1 (a text, b int, c int,
PRIMARY KEY (a, b))",
"CREATE TABLE testks.table2 (a text, b int, c int,
PRIMARY KEY (a, b))"),
"cassandra", "cassandra", null); {code}
We use default cassandra user to do it and executeAs actually ignores
AuthenticationException in this case, so we do not notice it.
It actually happen based on a log for a failed test run from CI (
[^TEST-org.apache.cassandra.transport.CQLUserAuditTest.log] ):
{code}
DEBUG [cluster1-nio-worker-0] 2026-01-28T07:41:10,135 Defuncting
Connection[localhost/127.0.0.1:9042-1, inFlight=0, closed=false] because:
Authentication error on host localhost/127.0.0.1:9042: Provided username
cassandra and/or password are incorrect
{code}
Why do we have this error after Cassandra startup? Because default cassandra
role creation is executed in async way, in a separate thread pool:
* org.apache.cassandra.service.StorageService#doAuthSetup(boolean)
* org.apache.cassandra.auth.CassandraRoleManager#scheduleSetupTask
Even if we set SUPERUSER_SETUP_DELAY_MS.setLong(0) still there is a probability
to have the job executed after our user creation logic.
We can observe it in the log:
{code}
DEBUG [cluster1-nio-worker-0] 2026-01-28T07:41:10,135 Defuncting
Connection[localhost/127.0.0.1:9042-1, inFlight=0, closed=false] because:
Authentication error on host localhost/127.0.0.1:9042: Provided username
cassandra and/or password are incorrect
{code}
executed before cassandra role creation:
{code}
INFO [OptionalTasks:1] 2026-01-28T07:41:10,355 Created default superuser role
'cassandra'
{code}
So, to make the test reliable we need to wait for cassandra role creation in
the test setup before other roles creation.
> Test Failure: org.apache.cassandra.transport.CQLUserAuditTest
> -------------------------------------------------------------
>
> Key: CASSANDRA-19165
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19165
> Project: Apache Cassandra
> Issue Type: Bug
> Components: CI
> Reporter: Ekaterina Dimitrova
> Assignee: Dmitry Konstantinov
> Priority: Normal
> Fix For: 5.1-beta
>
> Attachments:
> TEST-org.apache.cassandra.transport.CQLUserAuditTest.log,
> image-2026-01-31-16-43-11-984.png
>
>
> There are a number of tests in this test class that were failing, there might
> be dependency between them as they failed in the same run.
> - loginSuccessfulTest -
> [https://ci-cassandra.apache.org/job/Cassandra-trunk/1802/testReport/org.apache.cassandra.transport/CQLUserAuditTest/loginSuccessfulTest_trie_jdk17_x86_64/]
> - prepareStmt -
> [https://ci-cassandra.apache.org/job/Cassandra-trunk/1802/testReport/org.apache.cassandra.transport/CQLUserAuditTest/prepareStmt_trie_jdk17_x86_64/]
> - queryBatch -
> [https://ci-cassandra.apache.org/job/Cassandra-trunk/1802/testReport/org.apache.cassandra.transport/CQLUserAuditTest/queryBatch_trie_jdk17_x86_64/]
> - queryInsert -
> [https://ci-cassandra.apache.org/job/Cassandra-trunk/1802/testReport/org.apache.cassandra.transport/CQLUserAuditTest/queryInsert_trie_jdk17_x86_64/]
> - querySimpleSelect -
> https://ci-cassandra.apache.org/job/Cassandra-trunk/1802/testReport/org.apache.cassandra.transport/CQLUserAuditTest/querySimpleSelect_trie_jdk17_x86_64/
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]