Skip to main content

Friendica Admin Support Group reshared this.


guzzlehttp/psr7/src/Util.php


!Friendica Admin Support Group

Okay, after further digging I have excluded any issues with SELinux preventing caching. There have been no SELinux denials at all in the last three days so this issue is going to be in the code base. There are few things in life as enjoyable as hunting down a memory leak. Please note the heavy sarcasm :).

Update:

Okay, The function copyToString() in the Util.php allows the buffer to be read indefinitely or until it reaches an eof(). This only happens if the $maxLen variable is -1, which happens to be its default value. Because we end up in the body of this if() we know that either -1 was passed or the default value was used.

So apparently a file larger than 8gb was served up? That seems extreme though I have raised the bar to 12gb and waiting to see if that fails in time.

This seems reckless as a lot of servers may not have 8gb+ to offer up. This looks dubious and certainly a work around can be reached.

This entry was edited (5 days ago)
in reply to Unus Nemo

Rather than continuing to update the post I decided to update via comments.

I increased php memory_limit to 12gb. This has removed the error though I still am seeing issues. After getting some sleep and checking my resources memory usage went up. As I am the only active member this seems unlikely. Though I do have a relay configured so it is not like the instance does nothing while I am not active. Still requires more observation and I am still concerned in regards of a memory leak.

Of course I could put a band-aid on it and just put a cron job to restart the httpd every 6 hours though that should not have to happen. I would rather find the actual issue.

in reply to Unus Nemo

@Unus Nemo what log are you looking at? Have you enabled specific logging from friendica? I just enabled logging through the admin panel of my deployment so I don't have a great deal of data yet but I currently get nothing back from

find /var/log -type f -exec grep -H guzzlehttp {} \;

(my friendica log - now that it is enabled - is in that tree)

I'll keep looking... Also of note your reference to large files being uploaded and the fact that the image in your post is not displaying. I'll dig in the database to see if I can determine where friendica thinks that image should have landed on my host and see if I can run that question to ground.

in reply to Ken Gahagan

@Ken Gahagan I have my friendica log set to log/friendica.log in friendica's home directory. On my system that is /var/www/html/log/friendica.log.

It was the default and I did not bother to change it. Though I did have to create the log directory and touch friendica.log (create an empty log file) and be sure it had the correct file permissions.

I have my log settings on warning though If I turn it on to debug it blows my log file up so I have been waiting to deal with the errors and warnings before dealing with the debug issues.

You can also use journalctl to see some errors that are beyond just friendica.

This entry was edited (4 days ago)
in reply to Ken Gahagan

@Ken Gahagan That screenshot was only 519.1kB. It loads on my side though seeing it is saved on my server, that is not surprising. I have posted images to comments before and other users have seen them as they gave me feedback. So I know they are propagating at least in some instances.

Let me know what you find out please.


Friendica Admin Support Group reshared this.


Introduction


!Friendica Admin Support Group Hello, this is my first friendica group. I have not been on the fediverse for very long so excuse me if I am not well versed in all of its intricacies as of yet.

Okay, I guess I will start by laying out my instance setup as a foundation. I am also interested in hearing from others that have chosen other routes. Such as operating from a container, on a website such as GoDaddy that is not a VPS. I have some very definite opinions about those implementations though it would not surprise me if I was wrong. It has happened before.

I decided to go with a VPS. I host at IONOS . I have 8 vCPU, 16gb RAM, 256gb SSD. I have no idea how many users this might sustain. Though at the moment I am not convinced that it will be many until some significant issues have been addressed.

With IONOS I have the ability to choose my Operating System (OS) and I chose Rocky 9, as I use Fedora as my daily driver on my home systems and I am most familiar with RHEL and variants of it. I am also unimpressed with Canonical and their Ubuntu offerings. I agree that their server is less encumbered than their Desktop offering though I still just do not care for the company. I bring this up because most of the friendica development appears to be on Ubuntu. So a lot of the libraries and requirements I had to either build from a project on github, enable epel, or use pecl to install, rather than them being available in the OS default repo. This may be significant to someone starting out that is not so comfortable building projects, or installing from other repos, etc. In short, if you do not have any issues with Ubuntu, you will probably find a much smoother install via that Gnu/Linux variant than others. Feedback from anyone on an Ubuntu server would be appreciated.

I initially used a tar ball install though I realized that upgrading via this route would be cumbersome. So I opted to use the github install instead. As a vim user I am used to using github as an installation and upgrade solution. As with vim most plugins are handled this way.

I managed to coheres an install and that was a few hours of struggling to get the correct resources available due to my OS choice. I have elected to leave SELinux on as I feel with a production server it is the best security option. So disabling it to ease installation is simply not an option for me. If you also choose to use SELinux and are not a SELinux guru then I can help with some advice at working with it, rather than having to disable it.

one thing to keep in mind is that when SELinux blocks an event it logs it to the system journal and it is also nice enough, in most cases, to tell you how to enable it if you feel that this should not be blocked. For instance:

$ journalctl | grep -Ei "SELinux"

will show you all the journal entries that SELinux made and with possible fixes.

Such as enabling Httpd to use sendmail (or your choice of MTA) so your site can send outbound mail for user confirmation etc.

Right now I am experiencing a lot of issues with guzzlehttp/psr7/src/Utils.php exhausting memory. I am convinced this must be a memory leak as I cannot see a single php event requiring more than 8gb of memory, which is what I have enabled. I have not completely discounted it being a configuration issue though. Mabye SELinux is keeping a cache from being written? Not sure yet.

There are also issues with unhandled exceptions as well as mangled filenames not fitting into the db column. I am going to be looking into these issues though I have certain obstacles. First, I work full time and on days I work I have a 12 hour day and 1 hour one way commute so I do not do much more than sleep on and work on those days. Second, I am primarily a Systems Programmer so I am more comfortable with C, C++, Python etc than PHP, JavaScript, etc. Though I have done full stack development before and I just have to get back into the swing of things. Third, I am most definitely not a Database Administrator. I can work my way around and setup a simple schema but any level of complexity is likely to be beyond my experience.

I would love to hear some feedback from the challenges other admins are having, and how they decided to implement their instance. The pros and cons of that choice.

Have a Great Day!

Unus Nemo

This entry was edited (5 days ago)
in reply to Unus Nemo

I think it is all fair game and helpful. There will be others who run into the same issues. I may be shortly behind you in this respect.
in reply to Ken Gahagan

@Ken Gahagan Did you find your log file? I did not notice at first that it was telling me that the file did not exist. I had to create the actual file for it to start using it. These settings can be found in the admin settings first you configure were the log file is and what you are interested in logging. If you enable debug be prepared for a huge log file. Then you can view it in the second tab (vertical tab).

if you have root access and you have forwarded root mail to your default account then errors will also be sent to that account. I use mutt for viewing those emails. You could also use alpine. If you have a full blown public MTA setup then you could view it from your regular MUA.

This entry was edited (4 days ago)
⇧