?
avatar clayfreeman
clayfreeman
3 Aug 2018

Steps to reproduce the issue

  1. Cause an AppVeyor build to occur.
  2. Wait 1 - 2 hrs.
  3. Observe a possibly failed AppVeyor build.

Expected result

AppVeyor should complete the PHP 5.6 build in less than five minutes, similar to PHP 7.0, 7.1.

Actual result

AppVeyor's PHP 5.6 build takes 1 hour, minimum, in some instances and seemingly times-out.

System information (as much as possible)

n/a

Additional comments

The build gets stuck on PHP Unit.

avatar clayfreeman clayfreeman - open - 3 Aug 2018
avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Aug 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Aug 2018
Category Unit Tests
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Aug 2018

@rdeutz is this an Issue you can Comment?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21388.

avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Aug 2018
Status New Information Required
avatar rdeutz
rdeutz - comment - 13 Aug 2018

The reason for this is a polyfill for a crypto library there is not so much we can do

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Aug 2018

@rdeutz thanks for Comment.

@clayfreeman any Comment?

avatar clayfreeman
clayfreeman - comment - 13 Aug 2018

Which crypto library specifically? At what file path?

I'll take a look at the tests to see if there is any room for optimization.

avatar rdeutz
rdeutz - comment - 13 Aug 2018

If you have docker (or an php5.6 env) you can see yourself, run phpunit --testdox and you will see that the JCryptCipherSodiumTest takes a very long time. IIRC then it is the $cipher->generateKey(); method what takes so long. There is not so much room for improvement without running this method the test is useless. We might need to skip these tests.

avatar clayfreeman
clayfreeman - comment - 13 Aug 2018

I mean, the test suite passes currently. Nothing will change that unless the source for the polyfill changes. I'm all for skipping the Sodium test.

avatar rdeutz
rdeutz - comment - 15 Aug 2018

@clayfreeman can you make a PR?

avatar rdeutz
rdeutz - comment - 15 Aug 2018

maybe add $this->markTestSkipped('Takes too long on php5.6 and windows'); we can decide later if we need the test at all

avatar mbabker
mbabker - comment - 15 Aug 2018

we can decide later if we need the test at all

Oh, right, let's just remove tests validating that our cryptography API actually does what it's supposed to. THAT makes sense.

avatar clayfreeman
clayfreeman - comment - 15 Aug 2018

Its better than the entire unit test infrastructure failing due to timeouts. This can hide more serious issues under the veil of “Oh, it’s just another timeout; no need to actually investigate the failure since I already know what went wrong.”

Personally I think if we can reduce the key size for only the unit tests, it would be the best of both worlds. We can still test key generation and all related cryptography that way, and in theory the time required to generate keys can be cut down significantly.

Thoughts?

On Aug 15, 2018, at 7:15 AM, Michael Babker notifications@github.com wrote:

we can decide later if we need the test at all

Oh, right, let's just remove tests validating that our cryptography API actually does what it's supposed to. THAT makes sense.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

avatar clayfreeman
clayfreeman - comment - 15 Aug 2018

I've just looked through the problematic library and it doesn't seem that reducing the key size is possible. I did, however, find that \ParagonIE\Sodium\Compat::$fastMult can be set to true at runtime which might help alleviate the issue. I could see this only reducing the time required to run by little bit though since it may not even be related to the primary issue.

avatar clayfreeman
clayfreeman - comment - 15 Aug 2018

ParagonIE_Sodium_Core_Util::declareScalarType() is the culprit for the slow performance. This method looks like a fancy type cast proxy to facilitate strict types on PHP <= 5.6.

I personally vote that the entire test case is skipped or that pre-generated keys are used for testing instead. The likelihood of this functionality breaking in a way that doesn't result in an exception is extremely low in my opinion.

avatar wojsmol
wojsmol - comment - 15 Aug 2018

As we pin point issue to paragonie polyfill let me ping the author @paragonie-scott.

avatar rdeutz
rdeutz - comment - 15 Aug 2018

I looked at the documentation and they give some advice what you can do to make it faster, tried it but I couldn't see that it is really faster

avatar rdeutz rdeutz - change - 15 Aug 2018
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2018-08-15 21:18:33
Closed_By rdeutz
avatar rdeutz
rdeutz - comment - 15 Aug 2018

closed as we have a PR #21633

avatar rdeutz rdeutz - close - 15 Aug 2018

Add a Comment

Login with GitHub to post a comment