Hadoop java.io.IOException: Mkdirs failed to create /some/path

Just ran into this problem running mahout from CDH4 in standalone mode in my MacBook Air. The issue is that a /tmp/hadoop-xxx/xxx/LICENSE file and a /tmp/hadoop-xxx/xxx/license directory are being created on a case-insensitive file system when unjarring the mahout jobs. I was able to workaround this by deleting META-INF/LICENSE from the jar file like this: … Read more

Wait for file to be freed by process

A function like this will do it: public static bool IsFileReady(string filename) { // If the file can be opened for exclusive access it means that the file // is no longer locked by another process. try { using (FileStream inputStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.None)) return inputStream.Length > 0; } catch (Exception) { return … Read more

WPF IOException Cannot locate resource

The above did not work for me but what did work was as follows. Open up the App.xaml <Application x:Class=”dotDiff2013.App” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” StartupUri=”MainWindow.xaml”> <Application.Resources> </Application.Resources> </Application> You then need to change the start-up URI to the fully qualified one. In my case I had moved my MainWindow.xaml to a folder called ‘Main’, so changing the … Read more

HttpClient request throws IOException

It seems that this is caused by a recent security update for the .NET Framework: MS12-074: Vulnerabilities in .NET Framework could allow remote code execution: November 13, 2012 (KB 2745030) It all boils down to the following code in the web proxy resolution: [RegistryPermission(SecurityAction.Assert, Read=@”HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework”)] private static void InitializeFallbackSettings() { allowFallback = false; try { … Read more

How to check if IOException is Not-Enough-Disk-Space-Exception type?

You need to check the HResult and test against ERROR_DISK_FULL (0x70) and ERROR_HANDLE_DISK_FULL (0x27), which can be converted to HResults by OR‘ing with 0x80070000. For .Net Framework 4.5 and above, you can use the Exception.HResult property: static bool IsDiskFull(Exception ex) { const int HR_ERROR_HANDLE_DISK_FULL = unchecked((int)0x80070027); const int HR_ERROR_DISK_FULL = unchecked((int)0x80070070); return ex.HResult == HR_ERROR_HANDLE_DISK_FULL … Read more

When is “java.io.IOException:Connection reset by peer” thrown?

java.io.IOException: Connection reset by peer The other side has abruptly aborted the connection in midst of a transaction. That can have many causes which are not controllable from the server side on. E.g. the enduser decided to shutdown the client or change the server abruptly while still interacting with your server, or the client program … Read more