Opened 7 years ago

Closed 6 years ago

#11195 closed Patch - Feature (Fixed)

Patch: Adds detail when mythfilldatabase cache isn't writable

Reported by: Bill Meek <keemllib@…> Owned by: danielk
Priority: minor Milestone: 0.27
Component: MythTV - Mythfilldatabase Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Comments on the -users list suggest that additional detail in the logs will lead users to fix the problem of unwritable /tmp/mythtv_ddp_data files (likely caused by incorrectly running MFDB as root.)

For example: http://www.gossamer-threads.com/lists/mythtv/users/530443#530443

Attachments (5)

version.txt (827 bytes) - added by Bill Meek <keemllib@…> 7 years ago.
v0.27-pre-72-gda065e4-dirty
patch.txt (757 bytes) - added by Bill Meek <keemllib@…> 7 years ago.
patch-v2.txt (1.7 KB) - added by Bill Meek <keemllib@…> 7 years ago.
Corrected patch file.
patch-v3.txt (1.4 KB) - added by Bill Meek <keemllib@…> 7 years ago.
Without color escape sequences.
11195-v1.patch (8.2 KB) - added by danielk 7 years ago.
Eliminates use of temporary file in DataDirectProcessor::DDPost().

Download all attachments as: .zip

Change History (13)

Changed 7 years ago by Bill Meek <keemllib@…>

Attachment: version.txt added

v0.27-pre-72-gda065e4-dirty

Changed 7 years ago by Bill Meek <keemllib@…>

Attachment: patch.txt added

comment:1 Changed 7 years ago by Bill Meek <keemllib@…>

Please close. There is a case where this patch doesn't work. I'll re-open if I find a better solution.

comment:2 Changed 7 years ago by Raymond Wagner

Resolution: Won't Fix
Status: newclosed

Closed at submitter's request.

comment:3 Changed 7 years ago by Bill Meek <keemllib@…>

Resolution: Won't Fix
Status: closednew

I should have opened this as a bug, not a feature. Corrected patch attached.

For backends that don't (or rarely) boot, the /tmp/mythtv_ddp_data file may be found with permissions of 644 and an owner/group of the 1st user to run mythfilldatabase.

If the user running MFDB is always the same (most likely mythtv,) there is no problem.

If a user other than mythtv manually runs MFDB 1st, or if the backend is improperly started as root, mythtv user runs of MFDB by the BE fail.

This problem can be avoided by setting the permissioins on the file to allow anyone to write it (the 1st user to run the program does this and any other user silently fails to change them.)

Tested in the following cases:

If /tmp/mythtv_ddp_data doesn't exist,
  After creating it, change its mode to 666.

If a writable /tmp/mythtv_ddp_data exists,
  No change, normal run.

If /tmp/mythtv_ddp_data exists, and isn't writable,

  The following will appear in mythfilldatabase's log:

    E  DataDirect: Failed to get data: Aborting: /tmp/mythtv_ddp_data is not writable
    
  The run is aborted (no sense downloading data if the file can't be
  written.)

Changed 7 years ago by Bill Meek <keemllib@…>

Attachment: patch-v2.txt added

Corrected patch file.

Changed 7 years ago by Bill Meek <keemllib@…>

Attachment: patch-v3.txt added

Without color escape sequences.

comment:4 Changed 7 years ago by danielk

Milestone: unknown0.27
Owner: changed from stuartm to danielk
Status: newaccepted

It looks like DDPost is writing to a fixed file in "/tmp" rather than using the temporary file facility provided in the data direct class and this is causing all the grief.

Changed 7 years ago by danielk

Attachment: 11195-v1.patch added

Eliminates use of temporary file in DataDirectProcessor::DDPost().

comment:5 Changed 7 years ago by Bill Meek <keemllib@…>

It seems to work A-OK. Tested both as a housekeeping job and from the command line.

It appears that the download is now done to RAM, as I can't see a file created for the download. However, there was one for the "suggested next time" response e.g.: /tmp/mythtv_ddp_F48l0F/mythtv_result_DtUYEM

Downloaded 1.31429 megabytes in 37.853 seconds, decompressed to 14.8522 megabytes

I also simulated someone starting MFDB on top of a running housekeeping job by running MFDB --dd-grab-all...& twice will no adverse affects (I dumped the entire program table before and after the above and ran sha1sum on each with the same result.)

There won't be another housekeeping run to test until 11/7.

comment:6 Changed 7 years ago by Bill Meek <keemllib@…>

Apologies if this was waiting for more data from me. The fix is working fine. I have two logging suggestions:

The text in: libs/libmythtv/datadirect.cpp

+    LOG(VB_GENERAL, LOG_INFO, LOC + QString("Using Suggested Time Filename '%1'")
+        .arg(resultFilename));

needs a tuneup. "Using Filename '%1'" would make more sense in the log (remove Suggested Time.)

And in libs/libmythtv/datadirect.cpp, this LOG()

+    LOG(VB_GENERAL, LOG_INFO, LOC + QString("Using input '%1'")
+        .arg(inputfile));

always prints as:

... CoreContext datadirect.cpp:1182 (GrabData) - DataDirect: Using input ''

in my log files (there is never any text between the aphostrophies.)

comment:7 Changed 6 years ago by Bill Meek <keemllib@…>

Retested 8/28/2013. I don't see the above patch being committed (there's still reference to /tmp/mythtv_ddp_data in the source.)

However, now when running MFDB, that file doesn't appear.

Appears OK to close.

comment:8 Changed 6 years ago by stuartm

Resolution: Fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.