ElkArte Community

General => Chit Chat => Topic started by: ahrasis on November 09, 2016, 02:50:34 am

Title: If anyone can answer...
Post by: ahrasis on November 09, 2016, 02:50:34 am
I am trying to find what causes the following which happens immediately upon uninstall of my updated subforum addon package:
QuoteThe elkarte.ahrasis.com page isn’t working
elkarte.ahrasis.com is currently unable to handle this request.
HTTP ERROR 500
After a while, the page return to normal. The above doesn't affect any other addon though, so I guess it is not a server fault.

I also couldn't detect any relevant error in apache error log file or system log file.

Could it be because I edited mysql database files via this addon? Any suggestion where should I look further into?
Title: Re: If anyone can answer...
Post by: badmonkey on November 09, 2016, 07:00:24 am
Just a guess, could it be an out of memory error?  Are you running php fpm?  You may try raising the php memory limit and restarting php.

The other thought is a timeout issue.  If the first doesn't work try raising the execution timeout.
Title: Re: If anyone can answer...
Post by: emanuele on November 09, 2016, 07:13:38 am
You mean just when you click on "unisntall"?
1.0 or 1.1?
Title: Re: If anyone can answer...
Post by: ahrasis on November 09, 2016, 10:22:20 am
1.0, just after clicking uninstall and while going back to action=admin;area=packages.
Quote from: badmonkey – Just a guess, could it be an out of memory error?  Are you running php fpm?  You may try raising the php memory limit and restarting php.

The other thought is a timeout issue.  If the first doesn't work try raising the execution timeout.
I was running fast cgi. It could be, I will check all that out.
Title: Re: If anyone can answer...
Post by: emanuele on November 09, 2016, 11:16:24 am
Quote from: ahrasis – 1.0, just after clicking uninstall and while going back to action=admin;area=packages.
Sorry for being pedantic, but... heh, I want to be sure. :P ;)
So you get it two times?
Repeating the steps:
1) enter admin > packages
2) click "uninstall package" next to the package
3) click "uninstall" button in the page that summarize the uninstall steps,
4) confirmation page the addon has been unisntalled
5) redirect to the packages list.
From your sentence I understand it happens just after 3 and 5.
Is that correct?
Title: Re: If anyone can answer...
Post by: ahrasis on November 09, 2016, 11:36:03 am
After step 4 uninstall confirmation button is clicked and going to step 5.
Title: Re: If anyone can answer...
Post by: ahrasis on November 09, 2016, 07:15:05 pm
I already checked the execution time (1000) and memory limit (2048M), thus, I think they are not the causes.

My first thought was: while this addon restores database files to its original condition, deleted its own database files, and removes the hooks, the connection is somewhat / somewhere cut off, causing the above said error temporarily.

Unfortunately, testing the same on WAMP, the addon uninstalls just fine, no said error in continuous multiple installs and uninstalls.

Thus, I am coming back to my first thought or possibly, some server fault, on which the latter shows no clue, so far.
Title: Re: If anyone can answer...
Post by: badmonkey on November 09, 2016, 08:22:53 pm
Wow!  No, those shouldn't be problematic.  Lol!

Would you like an install/uninstall test cycle on another server?
Title: Re: If anyone can answer...
Post by: ahrasis on November 09, 2016, 10:39:04 pm
That would be great. The package I am testing is in this post:
http://www.elkarte.net/community/index.php?topic=2162.msg29377#msg29377

This package is already in used in http://elkarte.sch.my with one of its subforum http://x-mans.sch.my.
Title: Re: If anyone can answer...
Post by: badmonkey on November 10, 2016, 09:34:33 am
Installation worked perfectly.  MultiTenancy Configuration displays in the Forum tab in the ACP. 

(Link-4332)

At this point I seem to be experiencing a bug: the package doesn't show in the ACP Package Manager. 


(Link-4334)
Title: Re: If anyone can answer...
Post by: ahrasis on November 10, 2016, 07:23:25 pm
Eh... that's strange?! The package is shown fine in my forum package browser. Is there any error logs?
Title: Re: If anyone can answer...
Post by: badmonkey on November 10, 2016, 08:38:39 pm
Indeed there are. 

Type of error: General
2: Parameter 1 to Tenancy::BufferUrl() expected to be a reference, value given


It's probably worth mentioning the server is running php7.   ;)
Title: Re: If anyone can answer...
Post by: emanuele on November 11, 2016, 03:50:40 am
O_o

I can't remember any Tenancy class in elk... maybe in some addon?
Title: Re: If anyone can answer...
Post by: badmonkey on November 11, 2016, 07:34:42 am
Woops.  Sorry.  I would assume that's a class in ahrasis' addon.  :)
Title: Re: If anyone can answer...
Post by: emanuele on November 11, 2016, 12:57:16 pm
Ohh....
/me hides
Title: Re: If anyone can answer...
Post by: badmonkey on November 11, 2016, 01:16:21 pm
You're too funny eman!  Lol! 

Thanks for offering help.  ;)
Title: Re: If anyone can answer...
Post by: ahrasis on November 11, 2016, 07:07:21 pm
It's my bad because first time I started using a buffer in smf, I think I remember it requires an ampersand before $buffer or otherwise it wouldn't work, so I wrongly thought that it could be related to elk integrate buffer code. The solution seems to remove the ampersand from (&$buffer). It is fixed, repacked and available in http://www.elkarte.net/community/index.php?topic=2162.msg29410#msg29410.

Question: I wonder why the others like (&$admin_areas) using integrate admin areas did not have this same affect on php 7?
Title: Re: If anyone can answer...
Post by: emanuele on November 12, 2016, 11:39:37 am
ob_start (http://php.net/manual/en/function.ob-start.php) (that is the function called when the output buffer is manipulated) has always worked that way.
The pass-by-reference (&) is used in the "internal" (let's call them that way) cases where you have to modify the value passed to the hook. The reason is very seldom only a single parameter is passed to call_integration_hook (or Hooks::hook), most of the times multiple parameters are passed (and some of them are not supposed to be changed), so it would be difficult to "decide" what to expect as a return value.
Title: Re: If anyone can answer...
Post by: ahrasis on November 12, 2016, 06:27:45 pm
Huhuhu... That's quite complicated to me to understand properly. In any event, thank you for the input.

Anyway,
@badmonkey, have you retested the newly packaged addon? Any error after the uninstallation?
Title: Re: If anyone can answer...
Post by: badmonkey on November 12, 2016, 10:48:27 pm
Here is some information on the last package, if it's helpful in any way.  The reason it didn't show in the installed list is because the file lost it's extension in the packages folder.  Edited the filename to add .zip, and presto!  It displayed as installed in the Package Manager.  :)
Title: Re: If anyone can answer...
Post by: badmonkey on November 12, 2016, 11:09:31 pm
Well....here is subsequent info.  This may be a bug not at all related to MESFA or I made some mistake.  Using the Download a package by url function in the PM yielded a file in the packages folder whose name reflected the url, but was not a viable file.  That was the method used to install the package before.  Not sure what significance, if any, that may hold.  


As for the updated package, it installed without issue.  As of yet there are no errors in the error log.  Nice work ahrasis!  How else may we help you?  :)
Title: Re: If anyone can answer...
Post by: ahrasis on November 13, 2016, 09:43:19 am
As the topic is concerned, I need to test its uninstallation.

As of the possible bug, I haven't tested the download via url method.
Title: Re: If anyone can answer...
Post by: badmonkey on November 13, 2016, 10:54:37 am
Woops.  Sorry, got on a tangent.  The uninstall gave a blank page upon completing the process.  But the uninstall process completed.

Here are the entries in the site directories error log:

Code: [Select]

[13-Nov-2016 10:47:05 America/New_York] PHP Notice:  SSI.php was unable to load a session!  This may cause problems with logout and other functions - please make sure SSI.php is included before *anything* else in all your scripts! in /public_html/SSI.php on line 219
[13-Nov-2016 10:47:05 America/New_York] PHP Warning:  Cannot modify header information - headers already sent by (output started at /public_html/main.php:9) in /public_html/sources/Subs.php on line 2857
[13-Nov-2016 10:47:05 America/New_York] PHP Warning:  Cannot modify header information - headers already sent by (output started at /public_html/main.php:9) in /public_html/sources/Subs.php on line 2858
[13-Nov-2016 10:47:05 America/New_York] PHP Warning:  Cannot modify header information - headers already sent by (output started at /public_html/main.php:9) in /public_html/sources/Subs.php on line 2864
[13-Nov-2016 10:47:05 America/New_York] PHP Warning:  Cannot modify header information - headers already sent by (output started at /public_html/main.php:9) in /public_html/sources/Subs.php on line 2873
[13-Nov-2016 10:48:17 America/New_York] PHP Fatal error:  Uncaught Error: Call to undefined function MultiTenancy() in /public_html/sources/Load.php:1240
Stack trace:
#0 /public_html/index.php(186): loadTheme()
#1 /public_html/index.php(145): elk_main()
#2 {main}
  thrown in /public_html/sources/Load.php on line 1240

Title: Re: If anyone can answer...
Post by: emanuele on November 13, 2016, 04:45:57 pm
So, the problem is "simply" that the function loadTheme is called after the file Tenancy.subs.php has been removed, but before the call to MultiTenancy is removed from Load.php... that is odd, but I guess it can happen.

It's a bit of a pain to fix actually, I see two ways to fix it:
1) wrap the function call with a check to see if the function exists,
2) convert the call to an hook-like structure.

1 would be something like:
Code: [Select]
	// MultiTenancy theme change
if (function_exists('MultiTenancy'))
{
$id_theme = MultiTenancy('LoadTheme', $id_theme);
}

While 2 would require some changes, so I guess it's not worth. :P
Title: Re: If anyone can answer...
Post by: ahrasis on November 13, 2016, 07:24:27 pm
Thank you very much.

As for number 2, I think I see that in @inter FlarumStyle addon. I guess that is what you mean by a hook-like structure.
Title: Re: If anyone can answer...
Post by: ahrasis on November 13, 2016, 11:39:23 pm
I think there is other occurrence of this MultiTenancy function that must be checked i.e. in index.php, and as such has made the necessary changes.

@badmonkey, can test the latest one in here: http://www.elkarte.net/community/index.php?topic=2162.msg29467#msg29467 ?
Title: Re: If anyone can answer...
Post by: badmonkey on November 14, 2016, 08:18:17 am
Absolutely!  The install worked perfectly, as did the uninstall.  No errors in the error log.  Good work ahrasis!   8)