Bug 20338 - err.log and out.log cannot be deleted once created via iOS simulator crash (requires reboot)
Summary: err.log and out.log cannot be deleted once created via iOS simulator crash (r...
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Debugger ()
Version: 7.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-06-04 10:43 UTC by Dan DeBilt
Modified: 2015-06-24 01:05 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Dan DeBilt 2014-06-04 10:43:02 UTC
I use visual studio on my Windows 7 PC. I "smb" into my Windows 7 PC from my Mac (10.9.3), and also open that same project within Xamarin Studio. I find that it's easier to start a debug session from the Mac, rather than directly from visual studio.

When debugging on my mac, via Xamarin Studio, and the iOS Simulator crashes, an "err.log" and "out.log" file are created in the /bin/iPhoneSimulator/Debug directory of my iOS project (which is on my Windows PC). Once they are created, they cannot be deleted from either my Windows PC or Mac (I am administrator on both machines). I also can no longer start a new debug session, because "access is denied", caused by those two files existing. I've confirmed that the current owner of the files ("err.log" and "out.log") is still "Administrators". The user account that I "smb" into my Windows PC, via my Mac, is the same account that I use in Windows. 

I am only able to delete those two files after rebooting my Windows PC.
Comment 1 Sebastien Pouliot 2014-06-04 11:58:43 UTC
I'm not sure from the description (I only use a Mac) but remember that your application and the simulator are two different applications (in fact the simulator has several process itself).

You likely crashed your application (not the simulator) and the log files are still being opened (and locked) by the simulator itself. Make sure that all simulator processes are killed. There are windows tools to allow you to see which process has which file opened (filemon IIRC).

If nothing else is running then it could be a smb issue (lock held for a crashed process) but let's confirm the above to start.
Comment 2 Dan DeBilt 2014-06-04 12:47:29 UTC
Thank you for the suggestions. I wasn't able to find any lock on the files using Process Monitor. So, I took Visual Studio out of the equation and now my Windows PC is just used solely for the file storage (using smb). 

I cleaned everything up, and opened the solution in Xamarin Studio on my mac, launched the simulator and initially it will work. After stopping debugging, and re-launching a debug session again, the simulator starts to hang before the initial UIViewController is shown (partially shows the "splash" and stalls), and eventually falls back to the simulator home screen. At that point, I am no longer able to build or re-launch a debugging session because those two files are locked.

I then shutdown the simulator, and looked into the Activity Monitor for any process that I thought were related (SimulatorBridge & launchd_sim). After killing those processes, the files were still locked. A mac reboot will auto-delete the files on the Windows PC, so you are correct in that something on the mac is locking them up.

Do you have any suggestions on which mac processes I could also try killing in order to free up those files?
Comment 3 Sebastien Pouliot 2014-06-04 13:05:56 UTC
I'm at WWDC and do not have a windows box to duplicate this. C.c. PJ to see if someone from QA can duplicate the issue.
Comment 4 Dan DeBilt 2014-06-04 13:56:17 UTC
This isn't an urgent issue, so it could wait. I have found a work-around that doesn't require a reboot. 

Here are the steps to replicate (which I can reproduce every time):

1. Create a new Xamarin.Forms PCL project on the Windows PC.
2. Update to newer Xamarin.Forms via NuGet
3. Connect to Windows PC from Mac via SMB
4. Open project in Xamarin Studio and start debugging (iOS Retina (4 inch) / 7.1)
5. Stop debugging
6. Wait a few seconds
7. Start debugging again (same sim hardware settings)
- Simulator will hang as it's bringing app to foreground. After a few seconds it will fall back to home screen.
8. Stop debugging
9. Subsequent attempts to debug the iOS project will result in "Cannot execute ...  is denied." error.

Work-around:
1. Close solution in Xamarin Studio
2. Eject shared Windows PC drive (sometimes it says it cannot because other processes are using it, in that case I close the simulator as well and it will allow the eject).
Comment 5 Mohit Kheterpal 2014-06-04 15:07:00 UTC
I have checked this issue and followed the steps mention in comment 4.
And every time I am able to launch simulator successfully as shown in screencast : http://screencast.com/t/tNrUHG27
Comment 6 Mohit Kheterpal 2014-06-04 15:08:02 UTC
I have checked this issue and followed the steps mention in comment 4.
And every time I am able to launch simulator successfully as shown in
screencast : http://screencast.com/t/tNrUHG27
Comment 7 Dan DeBilt 2014-06-04 15:49:23 UTC
Thanks for posting that screencast. 

I believe I have found the difference. When the iOS project is not set as the startup project, and I start a debug session with the "Run With" option, the issue occurs. However, when I set my iOS project as the startup project for the solution, as is with your re-creation, it behaves without issue (as is seen in your screencast).

If you are still unable to reproduce, I will also post a screencast as well.
Comment 8 Mohit Kheterpal 2014-06-05 04:45:12 UTC
Thanks Dan

I have again checked this issue and start debug session with the "Run With" option, And every time I am still able to deploy application on simulator as shown in screencast : http://screencast.com/t/e7tEelX1

Please have a look.
Comment 9 Dan DeBilt 2014-06-05 09:44:09 UTC
Ok, let's just close/reject this bug report. There must be something on my end that is causing the issue, and I will set the start-up project to iOS to avoid the issue I am seeing.
Comment 10 Rolf Bjarne Kvinge [MSFT] 2014-06-09 08:12:54 UTC
You can use the lsof tool to find which process uses a particular file. Just execute the following from a terminal (on the Mac):

    lsof | grep err.log

You can also probably delete those files if you disconnect the Mac from your Windows machine (http://technet.microsoft.com/en-us/library/cc737199(v=ws.10).aspx)