OJS3: getRemoteDomain: Slow browsing

Hi :slight_smile:
I’ve upgraded to OJS3 and every page build takes minutes!

I’ve created an slowlog and this function caused it:

	/**
	 * Get the remote domain of the current request
	 * @return string
	 */
	function getRemoteDomain() {
		$_this =& PKPRequest::_checkThis();

		static $remoteDomain;
		if (!isset($remoteDomain)) {
			$remoteDomain = null;
			$remoteDomain = @getHostByAddr($_this->getRemoteAddr());
			HookRegistry::call('Request::getRemoteDomain', array(&$remoteDomain));
		}
		return $remoteDomain;
	}

Why does OJS need this? Is there a way to disable this?

My slowlog:

[20-Mar-2017 07:49:30]  [pool ojs3.jki.intern] pid 17383
script_filename = /var/www/ojs3.jki.intern/index.php
[0x00007f1bf5e2b600] gethostbyaddr() /var/www/ojs3.jki.intern/lib/pkp/classes/core/PKPRequest.inc.php:458
[0x00007f1bf5e2b468] getRemoteDomain() /var/www/ojs3.jki.intern/classes/issue/IssueAction.inc.php:157
[0x00007f1bf5e2b218] subscribedDomain() /var/www/ojs3.jki.intern/pages/article/ArticleHandler.inc.php:278
[0x00007f1bf5e2af68] userCanViewGalley() /var/www/ojs3.jki.intern/pages/article/ArticleHandler.inc.php:100
[0x00007ffd1df1a4a0] view() unknown:0
[0x00007f1bf5e2ad90] call_user_func() /var/www/ojs3.jki.intern/lib/pkp/classes/core/PKPRouter.inc.php:372
[0x00007f1bf5e2ab88] _authorizeInitializeAndCallRequest() /var/www/ojs3.jki.intern/lib/pkp/classes/core/PKPPageRouter.inc.php:239
[0x00007f1bf5e2aa28] route() /var/www/ojs3.jki.intern/lib/pkp/classes/core/Dispatcher.inc.php:134
[0x00007f1bf5e2a8c8] dispatch() /var/www/ojs3.jki.intern/lib/pkp/classes/core/PKPApplication.inc.php:227
[0x00007f1bf5e2a7d8] execute() /var/www/ojs3.jki.intern/index.php:68

Thanks in advance :wink:

Hi @Commifreak,

Does some of your content require a subscription to access it? OJS 3.0.x doesn’t support subscriptions (including domain-based authorization) but some of the back-end code is in place to check access. It may be that your content’s access configuration is set in a way that triggers the domain checking code in preparation for access control checking.

Regards,
Alec Smecher
Public Knowledge Project Team