RFR: 8331164: createJMHBundle.sh download jars fail when url needed to be redirected
Jaikiran Pai
jpai at openjdk.org
Sat Apr 27 01:18:05 UTC 2024
On Fri, 26 Apr 2024 16:23:28 GMT, SendaoYan <syan at openjdk.org> wrote:
>>> Hello @sendaoYan, who is adding the 302 redirect to that jar location and to which location is the URL being redirected to? What does `curl -v -O <the-url>` show in the logs (please paste the textual logs instead of an image).
>>
>> Hello @jaikiran
>>
>> - who is adding the 302 redirect to that jar location
>>
>> Is `server: Tengine` adding the 302 redirect? I am not sure.
>> - which location is the URL being redirected to
>> It's redirected to oss URL: `https://archiva-maven-storage-prod.oss-cn-beijing.aliyuncs.com/repository/central/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar?Expires=1714128070&OSSAccessKeyId=LTAIfU51SusnnfCC&Signature=RulXVJOdnC09nHSkGmZmN5NIS98%3D`
>>
>>
>> This is the full testual logs [curl.log](https://github.com/openjdk/jdk/files/15128464/curl.log).
>
>> Thank you for those details @sendaoYan.
>>
>> Adding `-L` (follow redirects) to unconditionally follow redirects doesn't look right to me. I think, one would want to know, during the build process, if any URLs that are in use (like this one) have changed their location and then decide if the build script should be updated to point to the new URL. I'll let the build team decide if this is OK to change. I don't know anything about the server (Maven mirror?) you are using that's generating this redirect, to suggest a workaround.
>
> @jaikiran Hello
> The `maven.aliyun.com` always redirects to a new OSS URL everytime, and the OSS URL will expired in 3600 secnods, as show below:
>
> yansendao at j66e07344:[tmp]> date +%s
> 1714148237
> yansendao at j66e07344:[tmp]> curl -OL -v --fail https://maven.aliyun.com/repository/public/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar 2>&1 | grep '> GET'
>> GET /repository/public/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar HTTP/2
>> GET /repository/central/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar?Expires=1714151841&OSSAccessKeyId=LTAIfU51SusnnfCC&Signature=%2BU29N2ems10WCjO%2FhhLJm6tT6tU%3D HTTP/1.1
> yansendao at j66e07344:[tmp]> curl -OL -v --fail https://maven.aliyun.com/repository/public/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar 2>&1 | grep '> GET'
>> GET /repository/public/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar HTTP/2
>> GET /repository/central/org/openjdk/jmh/jmh-core/1.37/jmh-core-1.37.jar?Expires=1714151845&OSSAccessKeyId=LTAIfU51SusnnfCC&Signature=iu2IfGjRq2p2PZJ6zMg8DtqWg%2Fg%3D HTTP/1.1
>
> So we can't use the final URL in script, because it will expired in short time.
> By the way, the [make/devkit/createGraphvizBundle.sh](https://github.com/openjdk/jdk/blob/master/make/devkit/createGraphvizBundle.sh#L93) file already use `curl -L`
>
>> grep curl make/devkit/createGraphvizBundle.sh
> curl -L -o "${file}" "${url}"
Hello @sendaoYan, I hadn't checked whether we already have such usage in our build scripts. Thank you for pointing me to it.
Erik's review is what matters here and he's explained that this change is OK and has approved the PR. So you can go ahead with this proposed change.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18965#issuecomment-2080295263
More information about the build-dev
mailing list