Web based family history software

Question error message

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago - 1 year 3 weeks ago #1 by jopla
error message was created by jopla
Hi,

I have a strange error. I got this message:
Code:
Allowed memory size of 134217728 bytes exhausted (tried to allocate 499712 bytes) /home/myuser/domains/mydomain.info/public_html/webtree/app/Media.php: 54

The error appears when I try to open the page of a person, but not at other persons. When I am logged in as guest, the error doesn't appear, and also not when I am logged in as administrator. The error appears only when I am logged in as normal user.

What can be the problem?
Last edit: 1 year 3 weeks ago by jopla.

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #2 by fisharebest
Replied by fisharebest on topic error message

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago #3 by jopla
Replied by jopla on topic error message
Maybe, but in that case I should think that there should be also an error when I am logged in as administrator ...

Please Log in or Create an account to join the conversation.

More
1 year 3 weeks ago #4 by fisharebest
Replied by fisharebest on topic error message
> Maybe, but in that case I should think that there should be also an error when I am logged in as administrator ...

Do you use watermarks on your site? These require more memory. The administrator does not see watermarks.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago - 1 year 3 weeks ago #5 by jopla
Replied by jopla on topic error message
I have done some tests with the watermarks settings in control panel>trees>preferences.

There are 4 options. With none of them the page is show for normal users, but I see it as administrator. If I choose "hide from everyone" I have a watermark on the picture (but the page isn't shown to users). I should think there shouldn't be shown a watermark in that case.

The picture itself seems not very big, 100x120 px.

Attachment picture.jpg not found



Do you have other suggestions?
Last edit: 1 year 3 weeks ago by jopla.

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 3 weeks ago - 1 year 3 weeks ago #6 by bertkoor
Replied by bertkoor on topic error message
Do you still have that error about not able to allocate any more memory?
You currently have a limit of 128mb which is rather low. I think with a php.ini file you can raise that, perhaps 160mb would already be enough.

Also i'm puzzled where exactly it goes wrong. What do logged in users exactly see?

Could you try these strategies to get more error details?
webtrees.net/faq/500/
webtrees.net/faq/xhr/

stamboom.BertKoor.nl runs on webtrees v2.1.20
Last edit: 1 year 3 weeks ago by bertkoor.

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago #7 by jopla
Replied by jopla on topic error message
The memory seems not to be the real problem. I raised it to 1048. In the admin mode the page opens correct. In the user mode I got now a 503 error.

Later I will look to your other suggestions.

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 3 weeks ago #8 by bertkoor
Replied by bertkoor on topic error message
Another thought, it might be an image from a source giving the issue.
Visitors by default don't see sources, but members do.

stamboom.BertKoor.nl runs on webtrees v2.1.20

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago #9 by jopla
Replied by jopla on topic error message

Another thought, it might be an image from a source giving the issue.
Visitors by default don't see sources, but members do.

How can I test / see that?

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 3 weeks ago - 1 year 3 weeks ago #10 by bertkoor
Replied by bertkoor on topic error message
Switch off the watermark feature and test whether the page loads for members. If yes, you're closer to finding the problem.

Watch the whole page & sources of the person, look for other images than the portrait.

stamboom.BertKoor.nl runs on webtrees v2.1.20
Last edit: 1 year 3 weeks ago by bertkoor.

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago #11 by jopla
Replied by jopla on topic error message

I have done some tests with the watermarks settings in control panel>trees>preferences.

There are 4 options. With none of them the page is show for normal users, but I see it as administrator. If I choose "hide from everyone" I have a watermark on the picture (but the page isn't shown to users). I should think there shouldn't be shown a watermark in that case.

As mentioned, I tested the watermarks before.

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago - 1 year 3 weeks ago #12 by jopla
Replied by jopla on topic error message

Could you try these strategies to get more error details?
webtrees.net/faq/500/
webtrees.net/faq/xhr/


 

I use PHP8.2.

With memory 512 or higher I got error 503 from the server (not from webtrees).

With memory 128 or 256 I got this message:
Code:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 479232 bytes) in /home/.../public_html/webtree/app/Media.php on line 54 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 479232 bytes) in /home/.../public_html/webtree/app/Validator.php on line 71 Fatal error: Uncaught ErrorException: PHP Request Shutdown: Cannot call session save handler in a recursive manner in Unknown:0 Stack trace: #0 [internal function]: Fisharebest\webtrees\webtrees::Fisharebest\webtrees\{closure}() #1 {main} thrown in Unknown on line 0

I was thinking:
On the page (and on an other page where was an error) there was a picture with a filename without extension. I added the extension. But still an error. Can I clean anywhere the cache or the thumbnails?


++++++
NEW / EXTRA info
Maybe can the following be the reason of the error. There is a source and the "text" of the source should be hidden (it has confidential information). Probably that possibility is outdated or was never allowed.
 

 
Last edit: 1 year 3 weeks ago by jopla. Reason: extra info

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 3 weeks ago - 1 year 3 weeks ago #13 by bertkoor
Replied by bertkoor on topic error message

With memory 512 or higher I got error 503 from the server (not from webtrees).

With memory 128 or 256 I got this message:
Code:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 479232 bytes) in /home/.../public_html/webtree/app/Media.php on line 54

The naieve approach would be to first try what happens with max memory set to 511 or 500. Give it substantially more than 256mb, but not enough to go beyond the maximum allowed by your provider, and cross fingers that is enough.

Another slightly more intelligent approach is figure out what webtrees is trying to do and come up with a hypothesis why this takes so much memory.

This is the code around line 54 of Media.php :
Code:
protected function canShowByType(int $access_level): bool { // Hide media objects if they are attached to private records $linked_ids = DB::table('link') ->where('l_file', '=', $this->tree->id()) ->where('l_to', '=', $this->xref) ->pluck('l_from'); foreach ($linked_ids as $linked_id) { $linked_record = Registry::gedcomRecordFactory()->make($linked_id, $this->tree); if ($linked_record instanceof GedcomRecord && !$linked_record->canShow($access_level)) { return false; } } // ... otherwise apply default behavior return parent::canShowByType($access_level); }

I think the code chokes on a record (indirectly?) referencing itself, creating an endless loop.

Worth a shot: export your tree as GEDCOM file, import in a new tree.
Navigate to the troublesome person in the new tree.
Most errors related to corrupt or illogical data are solved this way.

I was thinking:
On the page (and on an other page where was an error) there was a picture with a filename without extension. I added the extension. But still an error.
I'm curious how exactly you fixed this. Using the dialogs in webtrees? Doing SQL UPDATE statements and fumbling with files in the media folder?

The most error prone way I can think of, is to just remove the image and add it again, only using webtrees dialogs.
Actually, when logged in as an administrator you probably can do that!

stamboom.BertKoor.nl runs on webtrees v2.1.20
Last edit: 1 year 3 weeks ago by bertkoor.

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago - 1 year 3 weeks ago #14 by jopla
Replied by jopla on topic error message
Hi Bert,

Pictures:
The name of the file I changed as "admin". You can change in webtrees the filename. But the problem seems to be not in the image. (see under)

Other Individuals:
I found an individual without media objects but with the error.

Import GedCom:
Before I export/import the GedCom I should like to know what risks there are. Or better how to handle the media connected to the database.
Last edit: 1 year 3 weeks ago by jopla.

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 3 weeks ago - 1 year 3 weeks ago #15 by bertkoor
Replied by bertkoor on topic error message
> I found an individual without media objects but with the error.

What is the exact error message on that record? Where exactly does it go wrong?
Is that person perhaps linked to the same source as the other person?

If you import into a new tree (and have a database backup ready to restore, just in case) the risk is close to zero.
 

stamboom.BertKoor.nl runs on webtrees v2.1.20
Last edit: 1 year 3 weeks ago by bertkoor.

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 3 weeks ago - 1 year 3 weeks ago #16 by jopla
Replied by jopla on topic error message
I made an new tree from the exported gedcom. Still the same problem. I tested the user rights for this tree. As visitor no problem. As member, editor and moderator I get the error. As manager it works again.
Last edit: 1 year 3 weeks ago by jopla.

Please Log in or Create an account to join the conversation.

  • bertkoor
  • Offline
  • Platinum Member
  • Platinum Member
  • Greetings from Utrecht, Holland
More
1 year 3 weeks ago #17 by bertkoor
Replied by bertkoor on topic error message
Right...

What happens if you remove this media object completely?

stamboom.BertKoor.nl runs on webtrees v2.1.20

Please Log in or Create an account to join the conversation.

  • jopla
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 1 week ago - 1 year 5 days ago #18 by jopla
Replied by jopla on topic error message
Is it a software bug or not?

Finally I found the problem and I could repair.

The problem was a loop between a media-file and a source. But first it was difficult to find out were to search. The media-file was connected to a family. But that made that the children as also the grant-parents of both sides were not visible.

Why was there a loop?
I had a marriage picture. I published the whole picture as also the out-cuts from the individuals. To make a connection I made a source and connected the source to the 3 media object. But when you add a source you can add to that source a media object. (see   ) In this case the same. That give not in the administrator mode a bug, but in the member mode it does.

Maybe a good idea to check the program?
Last edit: 1 year 5 days ago by jopla. Reason: bug or not?

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum