Closed (fixed)
Project:
Feeds
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2019 at 11:51 UTC
Updated:
12 Dec 2024 at 14:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
megachrizThanks for the patch!
Do you also want to write a kernel or functional test for this case?
Comment #3
jcnventuraThis seems to be a better version of the patch in #3157339: HTTP Fetcher does not remove temp files if it throws an exception. Maybe mark that other issue as a duplicate?
Comment #4
jcnventuraComment #5
hugronaphor commentedRe-roll for alpha10
Comment #6
jcnventuraSeems that the reason for the failed tests is that unlink is not expected by the file system mock.
Comment #7
jcnventuraTests passed. The problem I see now, @MegaChriz is that the exception should not be thrown, and instead of an empty result should be returned. The rest of feeds should then handle that empty result gracefully. Should a new EmptyResult class be added and returned? Or instead return NULL?
Comment #8
heikkiy commentedWe tested this patch and it seems to fix the error mentioned in #3390530: Error: Call to a member function unlink() on null in Drupal\feeds\Result\HttpFetcherResult->cleanUp(). One thing that this seems to cause is that empty temporary files are never removed and this might fill up the temporary files folder
We have setup a custom cronjob to delete temporary files created by Feeds after 3 days but I think this should be also handled in the module that old temporary files are periodically removed?
Comment #9
megachriz@HeikkiY
The issue is that based on the age of a file, Feeds cannot determine if a file can be removed or not. A file could still be used in an active import. If for example cron runs only once a day and there is an import going on that takes more than 10 cron runs to complete, files that are older than a week could still be in use.
Comment #10
heikkiy commented@megachriz
I can understand the problem. One thing comes to my mind is that you can create different feed types in admin/structure/feeds where you can for example set how often the feed type is imported. Maybe there could be a setting also which would define how long temporary files are kept and based on that clean out old temporary files? Of course that is most likely outside of this issues scope so it would need a new ticket for that.
Comment #11
heikkiy commentedI reviewed our logs with the current patch from this issue and it seems like it didn't solve my problem in #3390530: Error: Call to a member function unlink() on null in Drupal\feeds\Result\HttpFetcherResult->cleanUp(). Even with this patch I am getting the same error about unlinking NULL values:
This seems to be the only PHP related error currently in the environment.
Comment #12
megachrizI see that this issue overlaps with #3372368: in_progress filesystem grows indefinitely. For the other one there is a fix that specifically handles 404 situations. The patch in #6 shows that it would be good to have automated tests for other cases as well:
I know that there are existing tests that work with the 304 response status.
\Drupal\feeds_test_files\Controller\CsvController::nodes()optionally returns that status. But perhaps this could be covered in a simpler way as well, with a Kernel test.Comment #14
megachrizI've added test coverage for this issue. Before also adding the fix, I think it would be good if #3372368: in_progress filesystem grows indefinitely gets in first. Please review that one, if you have time. :)
Comment #17
megachrizAll tests are passing! Merged the code!
Comment #19
jcnventuraComment #20
mitechworld commented