incubator-uniffle icon indicating copy to clipboard operation
incubator-uniffle copied to clipboard

[MINOR] fix(dashboard): Fix NPE while without targetAddress for api/server/nodes

Open maobaolong opened this issue 1 year ago • 5 comments

What changes were proposed in this pull request?

I use rest api without given targetAddress, the NPE encountered.

➜  ~ curl 'http://localhost:19988/api/server/nodes?status=active'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /api/server/nodes. Reason:
<pre>    java.lang.NullPointerException</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.24.v20180605</a><hr/>
</body>
</html>

Why are the changes needed?

Fix the NPE.

Does this PR introduce any user-facing change?

Without NPE through.

How was this patch tested?

 curl 'http://localhost:19988/api/server/nodes?status=active'

maobaolong avatar Jul 02 '24 08:07 maobaolong

We should not request the dashboard API directly. You can request the rest api of the coordinator.

xianjingfeng avatar Jul 02 '24 08:07 xianjingfeng

Test Results

 2 652 files   - 5   2 652 suites   - 5   5h 24m 44s :stopwatch: - 6m 48s    946 tests ±0     944 :white_check_mark:  - 1   1 :zzz: ±0  0 :x: ±0  1 :fire: +1  11 794 runs  +5  11 778 :white_check_mark: +4  15 :zzz: ±0  0 :x: ±0  1 :fire: +1 

For more details on these errors, see this check.

Results for commit bc92dba9. ± Comparison against base commit d32542ba.

This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.
org.apache.uniffle.shuffle.manager.RssShuffleManagerBaseTest ‑ testGetAttemptIdBits
org.apache.uniffle.shuffle.manager.RssShuffleManagerBaseTest ‑ testGetMaxAttemptNo
org.apache.uniffle.client.ClientUtilsTest ‑ testGetMaxAttemptNo
org.apache.uniffle.client.ClientUtilsTest ‑ testGetNumberOfSignificantBits

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jul 02 '24 08:07 github-actions[bot]

@xianjingfeng Thanks for your reply. I'd like to request coordinator directly, but sometimes we could export 8080 port as outside port, others are forbid to be accessed, so we can access coordinator or shuffle server rest api by dashboard api, normally, we have to specific targetAddress, and do you think it is not good enough to throw a NPE while targetAddress is not specified?

maobaolong avatar Jul 02 '24 10:07 maobaolong

@xianjingfeng Thanks for your reply. I'd like to request coordinator directly, but sometimes we could export 8080 port as outside port, others are forbid to be accessed, so we can access coordinator or shuffle server rest api by dashboard api, normally, we have to specific targetAddress, and do you think it is not good enough to throw a NPE while targetAddress is not specified?

If targetAddress is null, we can randomly choose a coordinator.

xianjingfeng avatar Jul 02 '24 11:07 xianjingfeng

@xianjingfeng This is a good idea

maobaolong avatar Jul 02 '24 11:07 maobaolong

@rickyma Thanks for you suggestion, I've added log, PTAL.

maobaolong avatar Jul 03 '24 07:07 maobaolong

@xianjingfeng PTAL

rickyma avatar Jul 07 '24 18:07 rickyma

Merged to master. Thanks @maobaolong @xianjingfeng

rickyma avatar Jul 10 '24 09:07 rickyma

Thanks for your review! @rickyma @xianjingfeng

maobaolong avatar Jul 10 '24 10:07 maobaolong