Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication is failing #65

Open
Exhibitioner opened this issue Dec 5, 2019 · 3 comments
Open

Replication is failing #65

Exhibitioner opened this issue Dec 5, 2019 · 3 comments

Comments

@Exhibitioner
Copy link

Hi, cool project!

I installed it and seems to work fine for the most part, but I am having issues with the replication.

I follow the steps in the docs: installed the first Chronicle instance, configured it up to MySQL, built tables and such. Then added a client and published some data to it.

Then I created a 2nd one, ran bin/replicate.php with a target of http://127.0.0.1:8080/chronicle and the first Chronicle's pub key. This seems to work well too, and adds an entry to the chronicle_replication_sources.

However, the secondary Chronicle does not seem to be replicating the source. I modified the "scheduled-attestation": to 360 seconds but not seeing any hashes on the secondary instance. I tried to execute the scheduled-tasks.php script and got the following error:

Fatal error: Uncaught ParagonIE\Chronicle\Exception\SecurityViolation: Invalid summary hash. Expected Pxqeejbjl-mAipyhtIDevQNmdpBHMN_-XBCZ6sQ1y7c=, calculated bpqrzUNnTsNg4aSHcBXOnn-qJzyUYB62MJtCSORr6bM= 

in src\Chronicle\Process\Replicate.php:203

I also truncated the chains and tried to replicate again, but no luck.

Do you have any idea why this might be?

@paragonie-scott
Copy link
Member

I'll take a look at this and see if I can reproduce it over the weekend.

@Exhibitioner
Copy link
Author

Awesome, thanks @paragonie-scott

Did you already look into whether you could reproduce this issue? I can try dump the summary hash details if you can't, and if that'd be useful?

@Exhibitioner
Copy link
Author

Exhibitioner commented Jan 10, 2020

I created a few VMs and did a fresh install and still seem to be reproducing this replication issue with an entirely different system.

Cron error for replication is reporting:

PHP Fatal error:  Uncaught ParagonIE\Chronicle\Exception\SecurityViolation: Invalid summary hash. Expected 18lf6EB_TzsfD7d7RQHnEEQpcYcrIhqhgwUjHn2pCMY=, calculated 070zk85rSIa13RYS0mB_tx2bzjcE8xYlKSOq3z-hHQY= in /home/test/Desktop/chronicle-master/src/Chronicle/Process/Replicate.php:203
Stack trace:
#0 /home/test/Desktop/chronicle-master/src/Chronicle/Process/Replicate.php(120): ParagonIE\Chronicle\Process\Replicate->appendToChain(Array)
#1 /home/test/Desktop/chronicle-master/src/Chronicle/Scheduled.php(129): ParagonIE\Chronicle\Process\Replicate->replicate()
#2 /home/test/Desktop/chronicle-master/src/Chronicle/Scheduled.php(86): ParagonIE\Chronicle\Scheduled->doReplication()
#3 /home/test/Desktop/chronicle-master/src/Chronicle/Scheduled.php(60): ParagonIE\Chronicle\Scheduled->runAll()
#4 /home/test/Desktop/chronicle-master/bin/scheduled-tasks.php(36): ParagonIE\Chronicle\Scheduled->run()
#5 {main}
  thrown in /home/test/Desktop/chronicle-master/src/Chronicle/Process/Replicate.php on line 203

Published data is fine on the primary Chronicle, however when I visit /chronicle/lasthash on the replica, I get an odd looking "contents" value containing new lines and a bunch of other JSON data (possibly the reason of this issue?):

{
    "version": "1.2.x",
    "datetime": "2020-01-10T03:18:53+00:00",
    "status": "OK",
    "results": [
        {
            "contents": "{\n    \"version\": \"1.2.x\",\n    \"datetime\": \"2020-01-10T03:16:01+00:00\",\n    \"replication-hashes\": [\n        {\n            \"source\": \"9vGZsOzLYOJH7CNwN3xVxZ_ZBe4hU7FEN8Ow5hEy5Cdy\"\n        }\n    ]\n}",
            "prevhash": "49M20zuSS5Plh00i8GpSHV9ZxHv_6XOLvz1dHCyNqZE=",
            "currhash": "Tya2VvX5q6N7bNwCNwNxGSfEIkqO1iVZ4TE0EkKAj9A=",
            "summaryhash": "AVRSYr_F63m8pH2MS8goEWyVb99uOOxYvMfNL0bidWc=",
            "created": "2020-01-10 03:16:01",
            "publickey": "dxCzdorsD8OorKC3b6r9kgH85kYYhYaJzrNaGVTqld8=",
            "signature": "yAgxlgh-qilEQ6c1wcCDl4knYyMM79IegiJw25diLa5LhC9JKBjD-oTqT5etiW4SBOk4fLqZvdR-rMG7j72_BA=="
        }
    ]
}

chronicle_replication_chain on the replica system has 23 rows too, not sure why; but they all contain the same record data:

data: {
    "version": "1.2.x",
    "datetime": "2020-01-10T03:10:01+00:00",
    "replication-hashes": [
        {
            "source": "9vGZsOzLYOJH7CNwN3xVxZ_ZBe4hU7FEN8Ow5hEy5Cdy"
        }
    ]
}

Any idea why this might be happening?

I'm using PHP 7.3.11-1~deb10u1, 10.3.18-MariaDB-0+deb10u1 Debian 10, and the --mysql flag during installation. Currently running via composer start.

print_r($entry) in Replication.php - appendToChain($entry) gave me the correct contents from the primary so I assume it's some logic after this which is causing the issue

Array
(
    [contents] => Hello world :-)
    [prev] => 
    [hash] => oXnZNr9qKdW1VaZVXvMtjDsMZkEOCMCF57i6H5FD1QE=
    [summary] => 18lf6EB_TzsfD7d7RQHnEEQpcYcrIhqhgwUjHn2pCMY=
    [created] => 2020-01-10 03:16:58
    [publickey] => 5rVk9InKxcQp_2Bx0fl_yTPbyqv0X9Gl1o0CO6aF5WM=
    [signature] => caJ8GnP-PRb2KSh3afUX2DfmgeYDj3VTYiKz0mnUzEJbK4GEEkFLR6rFM4bmoqsP6TLZvt__eqYaeK1n7zTRBA==
)

chronicle_replication_chain is also empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants