Downloaded file failed MD5 check

Now you’re telling me you have the same issue on two other CMS’s? Can we see the logs from those instead then please. All we need is one clean set of logs showing the download from the client where the client reports the file as having an incorrect MD5 checksum.

I’ve tried on three CMSs and can’t replicate it with the exact same feeds you’re using.

Yes currently i am working on the win8.1 box, but i can also test it with the linux-cms, the same problem. not always reproducable, i think it depends on the feed or i something like that.

EDIT ok, i will now generate a debug on hosted cms

Thank you. Please ensure auditing is on for the display you get to download the content.

Yes have done that, now there is more info in the log.
http://s000.tinyupload.com/index.php?file_id=11443826849014816736

CMS on linux (hosted) and android client on odroid

And which files does the Player report as downloaded incorrectly?

I don’t know if i understand you right: search for md5

So in the log there’s lots of:

fopen(/home/www/web779/html/ds-0_lib/ticker_88f9a8a0a4ad210f5eb5f8b86bf55383) [function.fopen]: failed to open stream: No such file or directory
2

Which suggests that the files aren’t actually there in the CMS library?

yes, the file is not there

So it’s never going to download correctly if the file isn’t present.

The CMS hasn’t been able to write it, but it thinks it should have. So please check the filesystem permissions allow the CMS to write files to that location.

there are lot of ticker_* files there, but not the one you mention. But i will check the permissions now
EDIT: set 777 now on all files and folders recursive

So now you’d need to wait for the cache to expire before the CMS would try and download those images again from the original feed, or you could delete the ticker from the layout and add it again. That should remove the ticker files that relate to that feed (I believe)

Ok, will recreate the layout.
If you want we can let it be for today, you are working so much! Thank you again!

OK we can leave it if you like. Can you just check that CMS is 1.7.3 too? Some of the error messages in the log don’t tie up to the line numbers I’d expect for an unmodified 1.7.3 CMS so I think either there’s been some modification to the files already or it’s an older version. If so there are known bugs in the earlier 1.7 releases with this functionality.

Yes, this is version 1.7.1. If you say, i can also install the newest one tomorrow.
Here the debug log http://s000.tinyupload.com/index.php?file_id=17119990871663181067

(The windows version on xampp was 1.7.3)

It needs to be upgraded. It plain won’t work on 1.7.1

Ok, thank you very much again! I will try that tomorrow. I would be so happy if that fixes the md5-problem :scream:

As far as i can tell/test for now, it is working with the version 1.7.3 on shared hosting and win8 player, no md5-error again. I think you can close this issue now.

Why cms 1.7.3 on win and 1.7.1 on linux have the same md5-problem (and on different clients different results) i do not understand. (I would have installed 1.7.3 earlier!! I saw in version 1.7.3 the function addModuleFileFromUrl is now using curl)

Now i have a combination working. I try to figure out what the problem with xampp on win8 is. As soon as i find a solution/mistake i will report.

And for information, i had to comment out CURLOPT_FOLLOWLOCATION (yes, there are better solutions…) because of the following message:

<errormsg>curl_setopt_array() [<a href='function.curl-setopt-array'>function.curl-setopt-array</a>]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set</errormsg>
<errornum>2</errornum>
<errortype>Warning</errortype>
<scriptname>/home/www/web1108/html/xibo/lib/data/file.data.class.php</scriptname>
<scriptlinenum>260</scriptlinenum>

I am really happy that is working and now i can start improving the ticker or other features.

Thank you very much, have a good weekend

I’m glad you have it working.

The reason 1.7.1 doesn’t work is it’s broken - hence the release of 1.7.2 and then 1.7.3. The reason it doesn’t work on your Windows machine is that you have a hard disk error or filesystem corruption preventing the disk from being reliably read and written.

Last results (now testing on win8, maybe on my other system too, i need to check that) for information only:

I think i have multiple problems (not the filesystem) - for now, this is what i found (for information/testing only):

The error “Applying Security” is solved with: https://www.youtube.com/watch?v=Cn-dgqoeh9I

Recplaced downloadFile function:

public static function downloadFile($url, $savePath)
{
    // Use CURL to download a file
    // Open the file handle
	$fileHandle = fopen($savePath, 'c');

	if (flock($fileHandle, LOCK_EX | LOCK_NB)) {
		ftruncate($fileHandle, 0);
		
		// Configure CURL with the file handle
		$httpOptions = array(
			CURLOPT_TIMEOUT => 50,
			CURLOPT_SSL_VERIFYPEER => true,
			CURLOPT_USERAGENT => 'test',
			CURLOPT_HEADER => false,
			CURLOPT_FOLLOWLOCATION => true,
			CURLOPT_URL => $url,
			CURLOPT_FILE => $fileHandle
		);

		$curl = curl_init();

		// Set our options
		curl_setopt_array($curl, $httpOptions);

		// Exec saves the file
		curl_exec($curl);

		// Close the curl connection
		curl_close($curl);

		fflush($fileHandle); // leere Ausgabepuffer bevor die Sperre frei gegeben wird
		flock($fileHandle, LOCK_UN); 		
	} else {
		//echo "Konnte Sperre nicht erhalten!";
		//Debug::Error('Locked File: ' .$savePath);
		return;
	}
	
    // Close the file handle
    fclose($fileHandle);
}

In ticker-module on line 969

$mediaid = $this->mediaid;
$file = $media->addModuleFileFromUrl($link, 'ticker_' . $mediaid . '_' . md5($this->GetOption('url') . $link), $expires);

Error message from unlink: I think that function is/was also called multiple times (thats why temp folder is empty and unlink is called on a file that does not exist)

The problem with w+ when called multiple times:

"place the file pointer at the beginning of the file and truncate the file to zero length"

So you had corrupt filesystem permissions then. It still would be preventing files being read/written/deleted correctly.

I don’t understand why you’re making modifications to the downloadFile function?