gboudreau / Greyhole

Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.
http://www.greyhole.net
GNU General Public License v3.0
263 stars 34 forks source link

PHP 8.1: Fatal Error: Return type of metafile_iterator::rewind() should either be ... #292

Closed obelisk3847 closed 2 years ago

obelisk3847 commented 2 years ago

After upgrading Greyhole from version 0.15.0 to version 0.15.13 I am seeing the error message...

PHP Fatal Error: Return type of metafile_iterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; BT: greyhole[L4118]

The error shows up in clusters of 4 or 5 events every few hours spaced randomly of 1 to 2 minutes. It can also consistently be triggered by running a queue or status command on the console.

gboudreau commented 2 years ago

I don't think this is caused by a Greyhole update, but by a PHP update. Could you verify what PHP version you are running, and if it changed recently, maybe when you updated Greyhole.

obelisk3847 commented 2 years ago

Yes, PHP did update when I ran the Greyhole update (I assumed Greyhole needed the new version).

PHP 8.1.3 (cli) (built: Feb 21 2022 14:48:26) (NTS)

gboudreau commented 2 years ago

You should go back to PHP 8.0; I never tested greyhole with PHP 8.1 yet, so this is most likely an issue with PHP 8.1 that would require some investigations.

gboudreau commented 2 years ago

I should be able to release a version that should fix this. You'll be able to try that if you'd like.

gboudreau commented 2 years ago

version 0.15.14 was pushed to the yum/apt repos. That version should fix this problem with PHP 8.1 Let me know if it works or not for you. (Try the status or queue commands.)

obelisk3847 commented 2 years ago

I had to manually install 0.15.14 as apt could not find the update but have it running but the issue is still there with status and queue commands...

Mar 17 17:45:55 INFO daemon: Greyhole (version 0.15.14) daemon started. Mar 17 17:45:55 INFO daemon: Checking MySQL tables... Mar 17 17:45:57 DEBUG daemon: Loading metadata store backup directories... Mar 17 17:45:57 DEBUG daemon: Found 2 directories in the settings table. Mar 17 17:45:57 DEBUG daemon: Checking symlink at /usr/lib/x86_64-linux-gnu/samba/vfs/greyhole.so... Mar 17 17:45:57 DEBUG daemon: Is OK. Mar 17 17:45:57 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:01 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:02 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:46:07 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:12 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:15 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:46:17 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:22 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:25 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:27 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:30 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:46:32 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:37 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:40 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:42 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:44 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:46:47 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:52 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:54 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:46:58 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:47:01 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:06 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:11 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:12 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:47:15 ERROR stats: PHP Fatal Error: Return type of metafile_iterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; BT: greyhole[L4117] Mar 17 17:47:16 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:21 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:22 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:26 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:47:26 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:31 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:36 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:36 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:41 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:47:41 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:46 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:51 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:47:56 DEBUG sleep: Nothing to do... Sleeping. Mar 17 17:48:01 DEBUG read_smb_spool: Processing Samba spool... Mar 17 17:48:02 ERROR view-queue: PHP Fatal Error: Return type of metafile_iterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; BT: greyhole[L4117] `

gboudreau commented 2 years ago

Ah; the package is indeed "broken"... It removes all comments when packaging, but the fix for this is a comment! I'll need to change my packaging tools. Expect a 0.15.14-2 soon.

obelisk3847 commented 2 years ago

I have switched to 0.15.14-3 and do not see the PHP errors anymore but it seems that Samba is no longer notifying greyhole of file system operations (writes or deletes). Running fsck on the specific share will trigger the move of the file into the pool but this is not happening automatically anymore.

root@hda:~# dpkg -l greyhole Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-================================== ii greyhole 0.15.14-3 amd64 Drive pooling technology for Samba

bergang@hda:~$ smbd -V Version 4.13.17-Ubuntu

bergang@hda:~$ ll /usr/lib/x86_64-linux-gnu/samba/vfs/greyhole.so lrwxrwxrwx 1 root root 40 Mar 17 20:16 /usr/lib/x86_64-linux-gnu/samba/vfs/greyhole.so -> /usr/lib64/greyhole/greyhole-samba413.so

System Config : http://ix.io/3SIP

gboudreau commented 2 years ago

I don't see the required vfs_objects = greyhole, in your smb.conf..?

(Also, your Samba logs have a lot of errors, some of which are about greyhole-dfree, but maybe those are old, from when you tried to install manually?)

obelisk3847 commented 2 years ago

Thanks, that was the problem. I had a backup of the smb.conf and the settings must have got removed when I manually installed yesterday for some reason (my greyhole.conf also was reset which was very noticeable but I missed the change to smb.conf). These two lines were removed from the shares...

dfree command = /usr/bin/greyhole-dfree 
vfs objects = greyhole

As near as I can tell greyhole and PHP 8.1 appear to be behaving now.