mono-logo Downloads | Daily snapshots | Screenshots | Documentation | Bugs | Blogs

~/.wapi error message

Question 1: What does the following error message mean?

	Failed to attach shared memory!
	Falling back to non-shared handles

To properly implement the handle semantics expected by .NET applications where a handle number is all that its needed to pass a descriptor from one process to another and have it just work.

Handles are used to specify: files, events, locks, semaphores, sockets, pipes and processes descriptors. So two Mono processes can share any of those resources just by exchanging the handle tokens (a number) between them.

This is accomplished by using a helper process that is launched by the first Mono invocation (that is why you see two mono processes running on your machine).

The various Mono processes communicate with each other with a local file in the ~/.wapi directory (one per hostname, so this works fine over NFS).

If the system crashes, or all of the Mono processes are killed without a chance to shut down properly those files will remain there, but there will no longer be an owner for them. If a new Mono start up, it will notice that the file exists, but it will fail to contact the helper process, issuing the above warning.

Question 2: How do I fix the problem?

If you are sure that no other Mono process is running, you can just delete the contents of the ~/.wapi directory:

	rm -i ~/.wapi/*

If you can not delete those files (because say, you have a running Mono, you can disable the use of the shared handles setup by setting the MONO_DISABLE_SHM environment variable as well:

	# Notice: Highly discouraged
	bash$ export MONO_DISABLE_SHM=1

The above is highly discouraged as that will make process execution fail, and without that many things like XSP/ASP.NET or the C# compiler's -pkg: support will not work.