Ashwin Pankaj created KAFKA-14598:
-------------------------------------
Summary: Fix flaky ConnectRestApiTest
Key: KAFKA-14598
URL: https://issues.apache.org/jira/browse/KAFKA-14598
Project: Kafka
Issue Type: Bug
Components: KafkaConnect
Reporter: Ashwin Pankaj
Assignee: Ashwin Pankaj
ConnectRestApiTest sometimes fails with the message
```
ConnectRestError(404, '<html>\n<head>\n<meta http-equiv="Content-Type"
content="text/html;charset=ISO-8859-1"/>\n<title>Error 404 Not
Found</title>\n</head>\n<body><h2>HTTP ERROR 404 Not
Found</h2>\n<table>\n<tr><th>URI:</th><td>/connector-plugins/</td></tr>\n<tr><th>STATUS:</th><td>404</td></tr>\n<tr><th>MESSAGE:</th><td>Not
Found</td></tr>\n<tr><th>SERVLET:</th><td>-</td></tr>\n</table>\n\n</body>\n</html>\n',
'http://172.31.1.75:8083/connector-plugins/')
```
This happens because ConnectDistributedService.start() by default waits till
the the line
```
Joined group at generation ..
```
is visible in the logs.
In most cases this is sufficient. But in the cases where the test fails, we see
that this message appears even before Connect RestServer has finished
initialization.
```
- [2022-12-15 15:40:29,064] INFO [Worker clientId=connect-1,
groupId=connect-cluster] Joined group at generation 2 with protocol version 1
and got assignment: Assignment{error=0,
leader='connect-1-07d9da63-9acb-4633-aee4-1ab79f4ab1ae',
leaderUrl='http://worker34:8083/', offset=-1, connectorIds=[], taskIds=[],
revokedConnectorIds=[], revokedTaskIds=[], delay=0} with rebalance delay: 0
(org.apache.kafka.connect.runtime.distributed.DistributedHerder)
- [2022-12-15 15:40:29,560] INFO 172.31.5.66 - - [15/Dec/2022:15:40:29
+0000] "GET /connector-plugins/ HTTP/1.1" 404 375 "-" "python-requests/2.24.0"
71 (org.apache.kafka.connect.runtime.rest.RestServer)
- [2022-12-15 15:40:29,579] INFO REST resources initialized; server is
started and ready to handle requests
(org.apache.kafka.connect.runtime.rest.RestServer)
```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)