RFR(S): 8240734: ModuleHashes attribute not reproducible between builds

Yangfei (Felix) felix.yang at huawei.com
Thu Mar 12 13:42:52 UTC 2020


Hi,

> -----Original Message-----
> From: Alan Bateman [mailto:Alan.Bateman at oracle.com]
> Sent: Thursday, March 12, 2020 5:40 PM
> To: Yangfei (Felix) <felix.yang at huawei.com>; core-libs-dev at openjdk.java.net
> Subject: Re: RFR(S): 8240734: ModuleHashes attribute not reproducible
> between builds
> 
> On 12/03/2020 09:30, Yangfei (Felix) wrote:
> > So for the hashed to be stored in A, we may need relations like: B requires A,
> and C requires A.  Am I right?
> >
> Right, I see there was a typo in my mail, sorry about that. It might help to draw
> the DAG and then reverse the edges to easily identify the modules where the
> hashes will be stored.
> 

We did a quick try with three modules. The new test is uploaded to [1].  

Two problems here:  
a>  hash values are different for two different test run.  This is illustrate in [2].  I think this is introduced by the SHA-256 algorithm.  
    I didn't mention that our local consistency check is carried out in a specialized environment which avoids such a problem.  
    This means we cannot compare the jmod files with Files.mismatch directly in regular testing environment.  

b>  Looks like the reported issue cannot be reproduced by a small number of modules.  We tried [1] many times and it seems that the order of the two module hashes is stable.  
    Note: java.base module records hashes of 67 other modules.  

Suggestions?  

[1]
https://bugs.openjdk.java.net/secure/attachment/87281/ModuleHashOrderTest.java

[2]
Classfile /home/sunjianye/openjdk13-community/jdk/JTwork/scratch/jmods-first/cl|  Classfile /home/sunjianye/openjdk13-community/jdk/JTwork/scratch/jmods-second/
    Last modified Mar 12, 2020; size 399 bytes                                   |    Last modified Mar 12, 2020; size 399 bytes
    SHA-256 checksum 1a8ea671cd45ffb96287d690e383a0f80303111ac51519271a097007b8e0|    SHA-256 checksum b7b0ce1af32eb74d2185e4feced2f25ae23ef2b3830b1fe2b7471ba9b34
    Compiled from "module-info.java"                                             |    Compiled from "module-info.java"
  module ma                                                                      |  module ma
    minor version: 0                                                             |    minor version: 0
    major version: 57                                                            |    major version: 57
    flags: (0x8000) ACC_MODULE                                                   |    flags: (0x8000) ACC_MODULE
    this_class: #2                          // "module-info"                     |    this_class: #2                          // "module-info"
+ +-- 51 lines: super_class: 
+ +#0--------------------------------------------------|+ +-- 51 lines: 
+ +super_class: #0-------------------------------------------------
    #17                                     // src.ma                            |    #17                                     // src.ma
  ModuleHashes:                                                                  |  ModuleHashes:
    algorithm: #25                          // SHA-256                           |    algorithm: #25                          // SHA-256
    2                                       // hashes                            |    2                                       // hashes
    #27                                     // mb                                |    #27                                     // mb
    hash_length: 32                                                              |    hash_length: 32
    hash: [633a60ff4fa542d082dba41ced181633385574c6a801c843a23538559b63c239]     |    hash: [951bb41ce54aa1bc93edde4226eeaf38d73f6a54b9e9e150c73e8a48d109de57]
    #29                                     // mc                                |    #29                                     // mc
    hash_length: 32                                                              |    hash_length: 32
    hash: [815cb047f93ec3d22ae2889d32a7f687e00b41507abbb1b66a27d87c5c38459a]     |    hash: [e2c37c902bf8b84ebbb11a765b365ba0fc241772596a8e4091e0345d596a86e5]


More information about the core-libs-dev mailing list