Opened 13 years ago

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

Download all attachments as: .zip

Change History (13)

by Bill Meek <keemllib@…>, 13 years ago

Attachment: version.txt added

v0.27-pre-72-gda065e4-dirty

by Bill Meek <keemllib@…>, 13 years ago

Attachment: patch.txt added

comment:1 by Bill Meek <keemllib@…>, 13 years ago

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

comment:2 by Raymond Wagner, 13 years ago

Resolution: Won't Fix
Status: newclosed

Closed at submitter's request.

comment:3 by Bill Meek <keemllib@…>, 13 years ago

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.)

by Bill Meek <keemllib@…>, 13 years ago

Attachment: patch-v2.txt added

Corrected patch file.

by Bill Meek <keemllib@…>, 13 years ago

Attachment: patch-v3.txt added

Without color escape sequences.

comment:4 by danielk, 13 years ago

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.

by danielk, 13 years ago

Attachment: 11195-v1.patch added

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

comment:5 by Bill Meek <keemllib@…>, 13 years ago

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 by Bill Meek <keemllib@…>, 13 years ago

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 by Bill Meek <keemllib@…>, 12 years ago

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 by stuartm, 12 years ago

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