Exception during generation of PhpNetClass.dynamic.dll

Discussion about the open-source Phalanger [?] project.

Exception during generation of PhpNetClass.dynamic.dll

Postby kripper » February 19th, 2012, 1:49 am

I compiled Phalanger 3 from SVN.
When running on Mono 2.10.8, sometimes I get a exception (see below). Other times it works (I'm still trying to figure out why).

Code: Select all
Thread was being aborted
 
Description: HTTP 500. Error processing request.
 
Stack Trace:

System.Threading.ThreadAbortException: Thread was being aborted
  at (wrapper managed-to-native) System.IO.MonoIO:Open (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,System.IO.FileOptions,System.IO.MonoIOError&)
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00230] in /root/Desktop/mono-2.10.8/mono-2.10.8/mcs/class/corlib/System.IO/FileStream.cs:307
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
  at System.Reflection.Emit.ModuleBuilder.Save () [0x00214] in /root/Desktop/mono-2.10.8/mono-2.10.8/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs:764
  at System.Reflection.Emit.AssemblyBuilder.Save (System.String assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine) [0x00278] in /root/Desktop/mono-2.10.8/mono-2.10.8/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs:988
  at System.Reflection.Emit.AssemblyBuilder.Save (System.String assemblyFileName) [0x00000] in /root/Desktop/mono-2.10.8/mono-2.10.8/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs:999
  at PHP.Core.Emit.LibraryBuilder.CreateDynamicWrapperInternal (System.Type attr, System.Reflection.Assembly assembly, System.String directory) [0x00000] in <filename unknown>:0
  at PHP.Core.Emit.LibraryBuilder.CreateDynamicWrapper (System.Type attr, System.Reflection.Assembly assembly, System.String directory) [0x00000] in <filename unknown>:0
  at PHP.Core.Emit.LibraryBuilder.CreateDynamicWrapper (System.Reflection.Assembly assembly, System.String directory) [0x00000] in <filename unknown>:0
  at PHP.Core.Reflection.PhpLibraryModule.LoadDynamicWrapper () [0x00000] in <filename unknown>:0 


After deleting the corrupted *.dynamic.dll file + all cache and retrying, the file is generated, but I get another exception:

Code: Select all
System.Threading.ThreadAbortException: Thread was being aborted
  at Mono.Globalization.Unicode.SortKeyBuffer.AppendNormal (Byte category, Byte lv1, Byte lv2, Byte lv3) [0x000c1] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/Mono.Globalization.Unicode/SortKeyBuffer.cs:173
  at Mono.Globalization.Unicode.SimpleCollator.FillSortKeyRaw (Int32 i, ExtenderType ext, Mono.Globalization.Unicode.SortKeyBuffer buf, CompareOptions opt) [0x00102] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/Mono.Globalization.Unicode/SimpleCollator.cs:641
  at Mono.Globalization.Unicode.SimpleCollator.GetSortKey (System.String s, Int32 start, Int32 end, Mono.Globalization.Unicode.SortKeyBuffer buf, CompareOptions opt) [0x001d7] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/Mono.Globalization.Unicode/SimpleCollator.cs:592
  at Mono.Globalization.Unicode.SimpleCollator.GetSortKey (System.String s, Int32 start, Int32 length, CompareOptions options) [0x00025] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/Mono.Globalization.Unicode/SimpleCollator.cs:535
  at Mono.Globalization.Unicode.SimpleCollator.GetSortKey (System.String s, CompareOptions options) [0x00000] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/Mono.Globalization.Unicode/SimpleCollator.cs:527
  at System.Globalization.CompareInfo.GetSortKey (System.String source, CompareOptions options) [0x00037] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/System.Globalization/CompareInfo.cs:414
  at System.CultureAwareComparer.GetHashCode (System.String s) [0x00024] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/System/StringComparer.cs:176
  at PHP.Core.FullPath+PathEqualityComparer.GetHashCode (FullPath path) [0x00000] in <filename unknown>:0
  at PHP.Core.FullPath.GetHashCode () [0x00000] in <filename unknown>:0
  at System.Collections.Generic.GenericEqualityComparer`1[PHP.Core.FullPath].GetHashCode (FullPath obj) [0x0000d] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/System.Collections.Generic/EqualityComparer.cs:134
  at System.Collections.Generic.Dictionary`2[PHP.Core.FullPath,PHP.Core.ScriptLibraryDatabase+Entry].Resize () [0x00038] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:387
  at System.Collections.Generic.Dictionary`2[PHP.Core.FullPath,PHP.Core.ScriptLibraryDatabase+Entry].Add (FullPath key, PHP.Core.Entry value) [0x000be] in /opt/imatronix/src/mono/mono-2.10.9/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:429
  at PHP.Core.ScriptLibraryDatabase.ReflectLibraryNoLock (PHP.Core.Reflection.ScriptAssembly scriptAssembly) [0x00000] in <filename unknown>:0
  at PHP.Core.AssemblyLoader.LoadScriptLibrary (System.Reflection.Assembly realAssembly, System.String libraryRoot) [0x00000] in <filename unknown>:0
  at PHP.Core.AssemblyLoader.LoadScriptLibrary (System.String assemblyName, System.Uri assemblyUrl, System.String libraryRoot) [0x00000] in <filename unknown>:0


After retrying again, the *.dynamic.dll loads correctly.
kripper
 
Posts: 44
Joined: February 19th, 2012, 1:02 am

Re: Exception during generation of PhpNetClass.dynamic.dll

Postby Jakub Misek » February 19th, 2012, 10:48 am

Phalanger has to regenerate .dynamic.dll stub when corresponding .dll is changed. When it does not a write access (or another process is locking the file) it crashes.

The second crash can cause to not load the script library completely, so it has to be fixed. The exception says, StringComparer.CurrentCulture.GetHashCode(string) failed on Mono. This is implemented in as System.CultureAwareComparer.GetHashCode (System.String s) method. "s" is null?
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Exception during generation of PhpNetClass.dynamic.dll

Postby kripper » February 19th, 2012, 11:15 am

Jakub Misek wrote:Phalanger has to regenerate .dynamic.dll stub when corresponding .dll is changed. When it does not a write access (or another process is locking the file) it crashes.


I'm on Linux. AFAIK, files are not locked (not by the OS at least).
The file is created in the same "bin" directory of the .dll
The directory and all files are owned by the apache user.
I don't know why there is no access.
Actually, a 0 bytes dynamic.dll file is generated.

After removing the corrupted dynamic.dll and reloading the page (repeating both steps about 5 times), the file is created correctly.
kripper
 
Posts: 44
Joined: February 19th, 2012, 1:02 am


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 22 guests

cron

User Control Panel

Login

Who is online

In total there are 22 users online :: 0 registered, 0 hidden and 22 guests (based on users active over the past 5 minutes)
Most users ever online was 511 on April 27th, 2024, 10:11 pm

Users browsing this forum: No registered users and 22 guests