Re: [Mono-dev] Patch: XSLT thread safety

2008-07-17 Thread Joshua Tauberer
Steve Bjorg wrote:
> XSLTCompiledTransform is thread-safe.  Would that be an alternative for 
> you?

As far as I know, XSLTCompiledTransform (in Mono) just wraps the same 
code as XslTransformation, so they are equally thread safe.

The MSDN docs seem to basically say the same thing w.r.t. thread safety, 
as well (and not mentioning scripts and extension functions).

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Patch: XSLT thread safety

2008-07-17 Thread Joshua Tauberer
Atsushi Eno wrote:
> msxsl:script cannot be thread safe on transform operations as script
> writers could write any thread-unsafe operations.

Well, sure. There's lots a script can do to mess up the application, and 
it seems like scripts in transformations basically need full trust 
anyway because at the least they can go into an infinite loop and stop 
the thread. And if they need full trust, the application writer can make 
thread safety judgments based on his knowledge of the script.

 > If MSDN says it is thread safe for transformation, then that is wrong.
 > If it were correct, it requires whatever no one can achieve.

Not to go all semantics on you, but an API can't be wrong. Inconsistent, 
yes. But if it's inconsistent, that doesn't tell you which way to 
resolve the inconsistency. It seems perfectly sensible to resolve the 
inconsistency by saying "so long as any scripts and extension functions 
are also thread safe".

Josh
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Patch: XSLT thread safety

2008-07-17 Thread Joshua Tauberer
Okay, so, clearly I'm only writing more because it makes my life easier 
to have the patch in, and not because I particularly care about API 
compatibility...

The MSDN docs for System.Xml.Xsl.XslTransform say "XslTransform objects 
are only thread-safe for transform operations," which implies they are 
intended to be thread safe in the manner I suggested. (I didn't mention 
this initially because the docs for the Transform method don't mention 
anything about thread safety so I didn't think it was a part of the API. 
But I thought that it was suspicious because it is an obvious candidate 
for a thread-safe method, so I checked again.)

I'm not sure how msxsl:script works or why it would be a problem...?

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)


Atsushi Eno wrote:
> No. Because sorting could happen a lot.
> 
> Also, your patch brings wrong assumption that every XslTransform
> must be immutable, even when msxsl:script is involved (and I don't
> think we welcome "x is thread safe" "y is not" sort of complication).
> 
> You are anyways standing on wrong premise anyways. Create multiple
> XslTransform for each thread. Since newobj happens a lot, it shouldn't
> be a big problem (for you at least).
> 
> Atsushi Eno
> 
> Joshua Tauberer wrote:
>> Atsushi Eno wrote:
>>> Thanks for the patch, but I don't think it makes things better.
>>> It adds extra newobj cost at every transformation time, while we
>>> could just do it only once. And XslTransform does not have to be
>>> thread safe. If you use XslTransform in multithread scenario, you
>>> must create XslTransform for each thread.
>>
>> Can't the benefits outweigh the costs? There are plenty of newobj's 
>> throughout XSLT. One more isn't going to change much, and as far as 
>> I've found it's the only thing preventing XSLT from being thread safe, 
>> which is a big plus (for me at least).
>>

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Patch: XSLT thread safety

2008-07-14 Thread Joshua Tauberer
Atsushi Eno wrote:
> Thanks for the patch, but I don't think it makes things better.
> It adds extra newobj cost at every transformation time, while we
> could just do it only once. And XslTransform does not have to be
> thread safe. If you use XslTransform in multithread scenario, you
> must create XslTransform for each thread.

Can't the benefits outweigh the costs? There are plenty of newobj's 
throughout XSLT. One more isn't going to change much, and as far as I've 
found it's the only thing preventing XSLT from being thread safe, which 
is a big plus (for me at least).

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)

> 
> Atsushi Eno
> 
> 
> Joshua Tauberer wrote:
>>  From time to time I encounter index out of range errors in 
>> Mono.Xml.Xsl.XslSortEvaluator during my multi-threaded use of a single 
>> XSLT transform object, which I think was due to modifying the state of 
>> a XslSortEvaluator object during the processing of a document.
>>
>> I'm pretty sure the attached patch fixes the problem. At the least it 
>> didn't make things worse for me.
>>
>> I can commit if it's ok, though I don't know/remember how to run the 
>> XSLT tests so I haven't done that. Pointers welcome.
>>
>>
>> 
>>
>> ___
>> Mono-devel-list mailing list
>> Mono-devel-list@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Patch: XSLT thread safety

2008-07-14 Thread Joshua Tauberer
From time to time I encounter index out of range errors in 
Mono.Xml.Xsl.XslSortEvaluator during my multi-threaded use of a single 
XSLT transform object, which I think was due to modifying the state of a 
XslSortEvaluator object during the processing of a document.


I'm pretty sure the attached patch fixes the problem. At the least it 
didn't make things worse for me.


I can commit if it's ok, though I don't know/remember how to run the 
XSLT tests so I haven't done that. Pointers welcome.


--
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
Index: Mono.Xml.Xsl/ChangeLog
===
--- Mono.Xml.Xsl/ChangeLog	(revision 107873)
+++ Mono.Xml.Xsl/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2008-07-14  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+	* XslSortEvaluator.cs: Correct thread safety. Don't modify instance
+	  fields after template compilation.
+
 2008-06-03  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
 	* XsltDebuggerWrapper.cs : allow public methods in debugger instance.
Index: Mono.Xml.Xsl/XslSortEvaluator.cs
===
--- Mono.Xml.Xsl/XslSortEvaluator.cs	(revision 107873)
+++ Mono.Xml.Xsl/XslSortEvaluator.cs	(working copy)
@@ -47,7 +47,6 @@
 			this.select = select;
 			this.sorterTemplates = sorterTemplates;
 			PopulateConstantSorters ();
-			sortRunner = new XPathSorters ();
 		}
 
 		XPathExpression select;
@@ -66,15 +65,38 @@
 else
 	sorters [i] = sort.ToXPathSorter (null);
 			}
+
+			if (!isSorterContextDependent) {
+sortRunner = new XPathSorters ();
+sortRunner.CopyFrom (sorters);
+			}
 		}
 
 		public BaseIterator SortedSelect (XslTransformProcessor p)
 		{
+			XPathSorter [] sorters;  // hides the instance field of the same name
+			XPathSorters sortRunner; // hides the instance field of the same name
+
 			if (isSorterContextDependent) {
-for (int i = 0; i < sorters.Length; i++)
+// Build local data structures so we don't modify the
+// instance fields so that we are thread-safe.
+sorters = new XPathSorter [this.sorters.Length];
+for (int i = 0; i < sorters.Length; i++) {
 	if (sorterTemplates [i].IsContextDependent)
 		sorters [i] = sorterTemplates [i].ToXPathSorter (p);
+	else
+		sorters [i] = this.sorters [i];
+}
+
+sortRunner = new XPathSorters ();
+sortRunner.CopyFrom (sorters);
+
+			} else {
+
+sorters = this.sorters;
+sortRunner = this.sortRunner;
 			}
+			
 			BaseIterator iter = (BaseIterator) p.Select (select);
 			p.PushNodeset (iter);
 			p.PushForEachContext ();
@@ -90,7 +112,6 @@
 			p.PopForEachContext ();
 			p.PopNodeset ();
 
-			sortRunner.CopyFrom (sorters);
 			return sortRunner.Sort (list, iter.NamespaceManager);
 		}
 	}
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Patch/2nd Post: mod_mono restart

2008-07-14 Thread Joshua Tauberer

[Originally posted May 21...]

I encountered a problem when doing a mod-mono-server restart through the 
mod_mono control panel that when requests came in while the restart was 
in progress, the restart would fail, mod-mono-server would be forked but 
fail to start, and it would be continually forked at each request but 
still fail to start.


My solution was to disallow requests while a restart is in progress.

The attached patch allows mod-mono-server backends to be 'paused' with 
requests coming in dropped with 503s during that time. The control panel 
restart now pauses and resumes around the restart. You can also 
pause/resume from the control panel.


The patch also changes where locking is done for the active requests 
counter. (This should have no consequences.)


Attached. I'll commit if it's ok.

--
- Josh Tauberer

http://razor.occams.info
Index: ChangeLog
===
--- ChangeLog	(revision 103720)
+++ ChangeLog	(working copy)
@@ -1,3 +1,16 @@
+2008-05-21  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c: Always acquire a lock at the start of processing
+	a request. The active requests counter function now assumes the
+	lock is already aquired. Also added a accepting_requests flag
+	to the dashboard so that xsp configurations can be paused. Now
+	when restarting mod-mono-server from the control panel, the
+	configuration is set to not accepting requests (503s returned)
+	until after the restart. This fixed a problem that when requests
+	came in during a restart, mod-mono-server would never successfully
+	come back but it would keep getting forked. The flag can also
+	be turned on and off through the control panel.
+
 2008-05-20  Marek Habersack  <[EMAIL PROTECTED]>
 
 	* src/mod_mono.c: work correctly with IPv6 sockets, by detecting
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 103720)
+++ src/mod_mono.c	(working copy)
@@ -65,6 +65,7 @@
 	char restart_issued;
 	int active_requests;
 	int waiting_requests;
+	int accepting_requests;
 } dashboard_data;
 
 typedef struct xsp_data {
@@ -452,6 +453,7 @@
 xsp->dashboard->restart_issued = 0;
 xsp->dashboard->active_requests = 0;
 xsp->dashboard->waiting_requests = 0;
+xsp->dashboard->accepting_requests = 1;
 			}
 		}
 	}
@@ -1933,6 +1935,13 @@
 increment_active_requests (xsp_data *conf)
 {
 #ifndef APACHE13
+	/* This function tries to increment the counters that limit
+	 * the number of simultaenous requests being processed. It
+	 * assumes that the mutex is held when the function is called
+	 * and returns with the mutex still held, although it may
+	 * unlock and lock the mutex itself.
+	 */
+
 	apr_status_t rv;
 	
 	int max_active_requests = atoi(conf->max_active_requests);
@@ -1941,21 +1950,20 @@
 	/* Limit the number of concurrent requests. If no
 	 * limiting is in effect (or can't be done because
 	 * there is no dashboard), return the OK status. 
-	 * Same test as in the decrement function. */
-	if (max_active_requests == 0 || !conf->dashboard_mutex || !conf->dashboard)
+	 * Same test as in the decrement function and the
+	 * control panel. */
+	if (!conf->dashboard_mutex || !conf->dashboard)
 		return 1;
 		
-	rv = apr_global_mutex_lock (conf->dashboard_mutex);
-	/* Drop the request on failure to lock the dashboard because
-	 * we don't want to decrement the counter later since we couldn't
-	 * increment it here. */
-	if (rv != APR_SUCCESS)
-		return 0;
-		
 	// From here on, rv holds onto whether we still have
 	// the lock acquired, just in case some error ocurrs
 	// acquiring it during the loop.
-	if (conf->dashboard->active_requests >= max_active_requests) {
+	rv = APR_SUCCESS;
+	
+	/* If any limiting is in effect, and if there are the maximum
+	 * allowed concurrent requests, then we have to hold the request
+	 * for a bit of time. */
+	if (max_active_requests > 0 && conf->dashboard->active_requests >= max_active_requests) {
 		/* We need to wait until the active requests
 		 * go below the maximum. */
 		 
@@ -1965,7 +1973,6 @@
 		 * is max_active_req+max_waiting_req.
 		 */
 		if (conf->dashboard->waiting_requests >= max_waiting_requests) {
-			apr_global_mutex_unlock (conf->dashboard_mutex);
 			ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
 			  "Maximum number of concurrent mod_mono requests to %s reached (%d active, %d waiting). Request dropped.",
 			  conf->dashboard_lock_file, max_active_requests, max_waiting_requests);
@@ -2000,7 +2007,6 @@
 	 	// many requests are going, stop processing the
 	 	// request.
 		if (rv == APR_SUCCESS && conf->dashboard->active_requests >= max_active_requests) {
-			apr_global_mutex_unlock (conf->dashboard_mutex);
 			ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_

Re: [Mono-dev] Bug in mod_mono?

2008-06-13 Thread Joshua Tauberer
Luciano _ wrote:
> Hi:
> If this isn't a correct place to make this kind of question, about a 
> bug found in mod_mono, on Ubuntu (Server and Desktop 8.04) point me to 
> the correct place please.
> I've got now installed and running properly my apache with Mod_mono 2 
> (at least the samples works). But when i install, i add 
> mono+gtk+monodevelop and mono-apache-server2 and xsp2 and xsp2_base 
> (this are the names of the Ubuntu package on an official repository and 
> in the debian repository too) with aptitude.
> After the installation, all works great, except mod_mono. I try 
> everything, and finally found my solution in apache error log. 
> (/var/log/apache2/error.log). I found that mod_mono was calling 
> /bin/mod-mono-server and the real name was /bin/mono-apache-server2) I 
> finally resolve this by making a link (ln -s mono-apache-server 
> mono-apache-server2).
> Is this a mod_mono bug or maybe it is a bug from ubuntu package? (I 
> think that is a mod_mono error, beacause i try to compile from source 
> and i have the some problem.
> 
> Do i fill a bug report?

That's a packaging problem on Ubuntu's end. The name mod-mono-server is 
hard-coded into mod_mono's source files.

Though, you can also get around the problem by using a MonoServerPath 
directive in httpd.conf and specify the path to mono-apache-server2.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] mod_mono restart patch

2008-05-21 Thread Joshua Tauberer
I encountered a problem when doing a mod-mono-server restart through the 
mod_mono control panel that when requests came in while the restart was 
in progress, the restart would fail, mod-mono-server would be forked but 
fail to start, and it would be continually forked at each request but 
still fail to start.


My solution was to disallow requests while a restart is in progress.

The attached patch allows mod-mono-server backends to be 'paused' with 
requests coming in dropped with 503s during that time. The control panel 
restart now pauses and resumes around the restart. You can also 
pause/resume from the control panel.


The patch also changes where locking is done for the active requests 
counter. (This should have no consequences.)


Attached. I'll commit if it's ok.

--
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
Index: ChangeLog
===
--- ChangeLog	(revision 103720)
+++ ChangeLog	(working copy)
@@ -1,3 +1,16 @@
+2008-05-21  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c: Always acquire a lock at the start of processing
+	a request. The active requests counter function now assumes the
+	lock is already aquired. Also added a accepting_requests flag
+	to the dashboard so that xsp configurations can be paused. Now
+	when restarting mod-mono-server from the control panel, the
+	configuration is set to not accepting requests (503s returned)
+	until after the restart. This fixed a problem that when requests
+	came in during a restart, mod-mono-server would never successfully
+	come back but it would keep getting forked. The flag can also
+	be turned on and off through the control panel.
+
 2008-05-20  Marek Habersack  <[EMAIL PROTECTED]>
 
 	* src/mod_mono.c: work correctly with IPv6 sockets, by detecting
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 103720)
+++ src/mod_mono.c	(working copy)
@@ -65,6 +65,7 @@
 	char restart_issued;
 	int active_requests;
 	int waiting_requests;
+	int accepting_requests;
 } dashboard_data;
 
 typedef struct xsp_data {
@@ -452,6 +453,7 @@
 xsp->dashboard->restart_issued = 0;
 xsp->dashboard->active_requests = 0;
 xsp->dashboard->waiting_requests = 0;
+xsp->dashboard->accepting_requests = 1;
 			}
 		}
 	}
@@ -1933,6 +1935,13 @@
 increment_active_requests (xsp_data *conf)
 {
 #ifndef APACHE13
+	/* This function tries to increment the counters that limit
+	 * the number of simultaenous requests being processed. It
+	 * assumes that the mutex is held when the function is called
+	 * and returns with the mutex still held, although it may
+	 * unlock and lock the mutex itself.
+	 */
+
 	apr_status_t rv;
 	
 	int max_active_requests = atoi(conf->max_active_requests);
@@ -1941,21 +1950,20 @@
 	/* Limit the number of concurrent requests. If no
 	 * limiting is in effect (or can't be done because
 	 * there is no dashboard), return the OK status. 
-	 * Same test as in the decrement function. */
-	if (max_active_requests == 0 || !conf->dashboard_mutex || !conf->dashboard)
+	 * Same test as in the decrement function and the
+	 * control panel. */
+	if (!conf->dashboard_mutex || !conf->dashboard)
 		return 1;
 		
-	rv = apr_global_mutex_lock (conf->dashboard_mutex);
-	/* Drop the request on failure to lock the dashboard because
-	 * we don't want to decrement the counter later since we couldn't
-	 * increment it here. */
-	if (rv != APR_SUCCESS)
-		return 0;
-		
 	// From here on, rv holds onto whether we still have
 	// the lock acquired, just in case some error ocurrs
 	// acquiring it during the loop.
-	if (conf->dashboard->active_requests >= max_active_requests) {
+	rv = APR_SUCCESS;
+	
+	/* If any limiting is in effect, and if there are the maximum
+	 * allowed concurrent requests, then we have to hold the request
+	 * for a bit of time. */
+	if (max_active_requests > 0 && conf->dashboard->active_requests >= max_active_requests) {
 		/* We need to wait until the active requests
 		 * go below the maximum. */
 		 
@@ -1965,7 +1973,6 @@
 		 * is max_active_req+max_waiting_req.
 		 */
 		if (conf->dashboard->waiting_requests >= max_waiting_requests) {
-			apr_global_mutex_unlock (conf->dashboard_mutex);
 			ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
 			  "Maximum number of concurrent mod_mono requests to %s reached (%d active, %d waiting). Request dropped.",
 			  conf->dashboard_lock_file, max_active_requests, max_waiting_requests);
@@ -2000,7 +2007,6 @@
 	 	// many requests are going, stop processing the
 	 	// request.
 		if (rv == APR_SUCCESS &&

Re: [Mono-dev] Documentation for Mod_Mono

2008-04-29 Thread Joshua Tauberer
Andre van Staden wrote:
> Not sure if this is the correct list, but lets try.  I'm trying to get 
> Websites set up with Mod_Mono && Apache 2.2 on Ubuntu 8.04.  I cannot 
> get any information of the correct contents for the configuration 
> files.  Samples I could find on the internet is unclear, does not work 
> and even contradict each other.
> 
> Where can I find the Official Documentation for this module please ?

http://mono-project.com/Mod_mono

(I know the URL and have no idea anymore where it is linked from on the 
Mono website)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Using monodoce for non-official mono project

2008-04-03 Thread Joshua Tauberer
Manuel de la Pena wrote:
> I'm in a developing group that is planning to release an opensource API
> that we have developed. We are looking in to different ways of
> documenting the code. We have come across monodoc and monodocer. Is it a
> tool that can just be used with official mono projects??Is there any way
> to use it to document our API and upload the changes to our server?
> 
> A pointer to were locate this info would be greatly appreciated.

Yes. You can use monodocer to maintain XML documentation outside of your 
source files, and then monodocs2html to create static HTML documentation 
from that.

More here, though it is probably a little outdated:
http://mono-project.com/Generating_Documentation

Some example output:
http://razor.occams.info/code/semweb/semweb-current/apidocs/SemWeb/index.html
http://www.jprl.com/Blog/archive/development/2008/OptionSet.svn.htm
(the new things in the 2nd link might not be in Mono 1.1.9, not sure)

Jon Pryor is working on making the process a lot nicer...

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] RoleManagerModule NRE

2008-03-10 Thread Joshua Tauberer
Hi,

Occasionally I am seeing in my website a NRE in 
System.Web.Security.RoleManagerModule as follows:

System.NullReferenceException: Object reference not set to an instance 
of an object
   at System.Web.Security.RoleManagerModule.OnPostAuthenticateRequest 
(System.Object sender, System.EventArgs args) [0x7] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs:65
 

   at System.Web.HttpApplication+<>c__CompilerGenerated1.MoveNext 
() [0x001d9] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web/HttpApplication.cs:793
 

   at System.Web.HttpApplication+<>c__CompilerGenerated2.MoveNext 
() [0x002fd] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web/HttpApplication.cs:913
 

   at System.Web.HttpApplication.Tick () [0x0] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web/HttpApplication.cs:697

The offending line is accessing a private field (_config) that has not 
been initialized yet. It suggests that the problem is in the class's 
IHttpModule.Init, where it adds its event handlers to the 
HttpApplication *before* initializing _config, and an event handler is 
being called in the middle.

Is this a symptom of a larger problem --- i.e. event handlers should not 
be called until Init returns --- or is this a bug in this module and 
_config should be initialized first? (RoleManagerModule has been like 
this since r74728, 2007-03-21.)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono and xsp patches

2008-01-22 Thread Joshua Tauberer
Miguel de Icaza wrote:
>> In my case, I was having problems when the number of concurrent requests 
>> went above 20 or 25. (I forget the details. I've been using this patch 
>> for around 3-4 months... modulo changes I made today.)
> 
> Do you think this is a manifestation of this problem:
> 
>   http://www.mono-project.com/Article:ThreadPool_Deadlocks

I can't say for sure, and because I was debugging this back around 
September I don't even remember what conclusions I came to then. But I 
remember it certainly felt like a ThreadPool-type deadlock, and it was 
exactly around the right number of requests that ought to cause a 
deadlock if there are (as it seems) 50 threads in a ThreadPool by default.

> If so, it would be interesting to find out who is the consumer of the
> other threads in the thread pool.

Is it (or was it) still the case that xsp has its own ThreadPool? I 
didn't figure out where that was or who was using whose workers. But, 
IIRC, xsp uses one worker per request on the side that communicates with 
mod_mono and a second one per request on the side that starts up the 
ASP.NET routines. Then there are other workers used in ASP.NET 
processing, plus corlib-internal (etc.) workers. So there are quite a 
few per request.

> I wonder if we should set this limit in the managed code.

Not sure it would help, except to set the limit very high when it 
becomes a problem, which we can already do.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono and xsp patches

2008-01-21 Thread Joshua Tauberer
Marek Habersack wrote:
> On Mon, 21 Jan 2008 13:45:54 -0500, Joshua Tauberer <[EMAIL PROTECTED]> 
> scribbled:
>> Great, in that case, I'm attaching another patch for mod_mono that 
>> implements rate limiting. I had found that under relatively heavy load, 
>> mod-mono-server would deadlock. Incoming requests would hang forever, 
>> with the result that all of the Apache child processes would get tied up 
>> as more requests came in, and so all websites on the server would stop.
...
> Great stuff :) - please commit, thanks!

Great, now I'm up to date with SVN.

And I can let it be known that, with these changes, I've had no problems 
with mod_mono for many months under ~50k pageviews per day.

There is still some issue on httpd start (emitting right to the console 
and not to the error log):

File exists: Failed to create shared memory segment for backend '...' at 
'/tmp/mod_mono_dashboard_..._2'.

It doesn't seem to actually cause any problems, but it is very strange. 
The named file does not exist when Apache starts, and trying to unlink 
it right before the call that's causing that error doesn't do any good. 
It nevertheless complains about the file existing.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono and xsp patches

2008-01-21 Thread Joshua Tauberer

Marek Habersack wrote:

They're OK to go in, thanks!


Great, in that case, I'm attaching another patch for mod_mono that 
implements rate limiting. I had found that under relatively heavy load, 
mod-mono-server would deadlock. Incoming requests would hang forever, 
with the result that all of the Apache child processes would get tied up 
as more requests came in, and so all websites on the server would stop.


There are only so many worker threads in the XSP thread pool, and at a 
certain point they're going to get used up. I forget how many threads 
there are by default, maybe 128, but at a few workers per request, that 
number gets used up quickly. Obviously the right thing to do would be to 
make sure mod-mono-server doesn't hang when it runs out of worker 
threads (if this was even the problem), but barring a fix there, this 
did the job.


In my case, I was having problems when the number of concurrent requests 
went above 20 or 25. (I forget the details. I've been using this patch 
for around 3-4 months... modulo changes I made today.)


The patch by default limits the number of concurrent requests passed to 
mod-mono-server to 20. After that, it holds onto (by default) up to 20 
more, checking periodically until the initial 20 decreases or a timeout 
(hard-coded at 10 seconds). The two 20's are configurable with 
MonoMaxActiveRequests and MonoMaxWaitingRequests.


This will only work on Apache2 since it relies on the shared memory 
dashboards.


--
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
Index: ChangeLog
===
--- ChangeLog	(revision 93419)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2008-01-21  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c: Implemented configurable rate limiting
+	  with MonoMaxActiveRequests and MonoMaxWaitingRequests.
+
 2008-01-20  Joshua Tauberer  <[EMAIL PROTECTED]>
 
 	* src/mod_mono.c:
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 93419)
+++ src/mod_mono.c	(working copy)
@@ -63,6 +63,8 @@
 	uint32_t handled_requests;
 	time_t start_time;
 	char restart_issued;
+	int active_requests;
+	int waiting_requests;
 } dashboard_data;
 
 typedef struct xsp_data {
@@ -90,7 +92,9 @@
 	char is_virtual; /* is the server virtual? */
 	char *start_attempts;
 	char *start_wait_time;
-
+	char *max_active_requests;
+	char *max_waiting_requests;
+  
 	/* auto-restart stuff */
 	auto_restart_mode restart_mode;
 	uint32_t restart_requests;
@@ -446,6 +450,8 @@
 xsp->dashboard->start_time = time (NULL);
 xsp->dashboard->handled_requests = 0;
 xsp->dashboard->restart_issued = 0;
+xsp->dashboard->active_requests = 0;
+xsp->dashboard->waiting_requests = 0;
 			}
 		}
 	}
@@ -510,6 +516,8 @@
 	server->start_attempts = "3";
 	server->start_wait_time = "2";
 	server->no_flush = 1;
+	server->max_active_requests = "20";
+	server->max_waiting_requests = "20";
 	
 #ifndef APACHE13
 	apr_snprintf (num, sizeof (num), "%u", (unsigned)config->nservers + 1);
@@ -1895,6 +1903,118 @@
 }
 
 static int
+increment_active_requests (xsp_data *conf)
+{
+	apr_status_t rv;
+	
+	int max_active_requests = atoi(conf->max_active_requests);
+	int max_waiting_requests = atoi(conf->max_waiting_requests);
+
+	/* Limit the number of concurrent requests. If no
+	 * limiting is in effect (or can't be done because
+	 * there is no dashboard), return the OK status. 
+	 * Same test as in the decrement function. */
+	if (max_active_requests == 0 || !conf->dashboard_mutex || !conf->dashboard)
+		return 1;
+		
+	rv = apr_global_mutex_lock (conf->dashboard_mutex);
+	/* Drop the request on failure to lock the dashboard because
+	 * we don't want to decrement the counter later since we couldn't
+	 * increment it here. */
+	if (rv != APR_SUCCESS)
+		return 0;
+		
+	// From here on, rv holds onto whether we still have
+	// the lock acquired, just in case some error ocurrs
+	// acquiring it during the loop.
+	if (conf->dashboard->active_requests >= max_active_requests) {
+		/* We need to wait until the active requests
+		 * go below the maximum. */
+		 
+		/* However, we won't keep more than max_waiting_req requests
+		 * waiting, which means the max number of active Apache
+		 * connections associated with this mod-mono-server
+		 * is max_active_req+max_waiting_req.
+		 */
+		if (conf->dashboard->waiting_requests >= max_waiting_requests) {
+			apr_global_mutex_unlock (conf->dashboard_mutex);
+			ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
+			  "Maximum number of concurr

[Mono-dev] mod_mono and xsp patches

2008-01-20 Thread Joshua Tauberer

Hi,

I have two sets of patches: for mod_mono and xsp.

The mod_mono patch corrects a few minor things, like proper destruction 
of the new shm's and checking everything is initialized.


The xsp patch corrects a check that a request ID is valid by putting it 
within a lock, because requests could be finished after the check and 
before the lock is entered.


If these are OK, I have another mod_mono patch to follow.

--
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
Index: ChangeLog
===
--- ChangeLog	(revision 93328)
+++ ChangeLog	(working copy)
@@ -1,3 +1,25 @@
+2008-01-20  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c:
+	  ensure_dashboard_initialized:
+	  - Try to delete an existing lockfile before creating a mutex
+	(relevant if the lock type uses files).
+	  - Don't always try to remove the shm file (as root). This
+	means we could never attach to an existing shm. The file
+	ought to always be created as the apache user anyway.
+	Instead, only delete after a failed attach.
+	  - Code cleanup and fixes (a return should have been a goto).
+	  mono_execute_request:
+	  - Check that dashboard was actually created before accessing it.
+	  start_xsp:
+	  - Don't use the xsp->status flag in Apache 2+ since this is
+	handled by the new cross-process locking mechanism.
+	  terminate_xsp2:
+	  - No need to check if xsp->dashboard_shm was changed while
+	waiting for a lock: that's impossible. (It's not multi-threaded.)
+	  - Don't call apr_shm_detach before apr_shm_destroy. That's not
+	the right use of the API.
+
 2007-11-08  Wade Berrier  <[EMAIL PROTECTED]>
 
 	* configure.in: Version bump -> 1.2.6
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 93328)
+++ src/mod_mono.c	(working copy)
@@ -367,16 +367,6 @@
 	}
 #endif
 
-	if (!xsp->dashboard_shm) {
-		DEBUG_PRINT (1, "removing dashboard file '%s' as root", xsp->dashboard_file);
-		if (unlink (xsp->dashboard_file) == -1 && errno != ENOENT) {
-			ap_log_error (APLOG_MARK, APLOG_CRIT, STATUS_AND_SERVER,
-  "Failed to remove dashboard file '%s', further actions impossible. %s",
-  xsp->dashboard_file, strerror (errno));
-			return;
-		}
-	}
-	
 #if defined (APR_HAS_USER)
 	if (apr_uid_current (&cur_uid, &cur_gid, p) == APR_SUCCESS && cur_uid == 0) {
 		DEBUG_PRINT (2, "Temporarily switching to target uid/gid");
@@ -395,6 +385,12 @@
 
 	if (!xsp->dashboard_mutex) {
 		DEBUG_PRINT (1, "creating dashboard mutex = %s", xsp->dashboard_lock_file);
+		
+		if (unlink (xsp->dashboard_lock_file) == -1 && errno != ENOENT) {
+			ap_log_error (APLOG_MARK, APLOG_CRIT, STATUS_AND_SERVER,
+  "Failed to remove dashboard mutex file '%s'; will attempt to continue. %s",
+  xsp->dashboard_lock_file, strerror (errno));
+		}
 		rv = apr_global_mutex_create (&xsp->dashboard_mutex, xsp->dashboard_lock_file,
 	  get_apr_locking_mechanism (), p);
 		if (rv != APR_SUCCESS) {
@@ -417,7 +413,17 @@
 
 	if (!xsp->dashboard_shm) {
 		rv = apr_shm_attach (&xsp->dashboard_shm, xsp->dashboard_file, p);
-		if (rv != APR_SUCCESS) {
+		if (rv == APR_SUCCESS) {
+			xsp->dashboard = apr_shm_baseaddr_get (xsp->dashboard_shm);
+		} else {
+			DEBUG_PRINT (1, "removing dashboard file '%s'", xsp->dashboard_file);
+			if (unlink (xsp->dashboard_file) == -1 && errno != ENOENT) {
+ap_log_error (APLOG_MARK, APLOG_CRIT, STATCODE_AND_SERVER (rv),
+  "Failed to attach to existing dashboard, and removing dashboard file '%s' failed (%s). Further action impossible.",
+  xsp->dashboard_file, strerror (errno));
+goto restore_creds;
+			}
+	
 			DEBUG_PRINT (1, "creating dashboard '%s'", xsp->dashboard_file);
 			
 			old_umask = umask (0077);
@@ -425,29 +431,25 @@
 			umask (old_umask);
 			if (rv != APR_SUCCESS) {
 ap_log_error (APLOG_MARK, APLOG_CRIT, STATCODE_AND_SERVER (rv),
-	  "Failed to create shared memory segment for backend '%s'",
-	  xsp->alias);
-goto restore_creds;
+	  "Failed to create shared memory segment for backend '%s' at '%s'.",
+	  xsp->alias, xsp->dashboard_file);
 			} else {
 rv = apr_shm_attach (&xsp->dashboard_shm, xsp->dashboard_file, p);
 if (rv != APR_SUCCESS) {
 	ap_log_error (APLOG_MARK, APLOG_CRIT, STATCODE_AND_SERVER (rv),
 		  

Re: [Mono-dev] error compiling mod_mono 1.2.5 with apache 1.3

2007-09-25 Thread Joshua Tauberer
César González wrote:
> I am trying to compile mod_mono 1.2.5 with apache 1.3.34 on debian etch. 
> Configure scripts detects apache 1.3 on ends up with the following report :
...
> In file included from mod_mono.c:35:
> mod_mono.h:55:21: error: apr_shm.h: No such file or directory
> mod_mono.h:58:19: error: unixd.h: No such file or directory
...
> Does mod_mono 1.2.5 supports apache 1.3?

Apparently not anymore. :)

You should try #ifdef'ing things until it works. When I was first 
testing the recent changes involving shm's and unixd.h and hit problems, 
I patched mod_mono in a few places to make it work without those new 
things in effect, so it should (or almost) be possible to just #ifdef 
out the parts that rely on Apache 2.

To start with, in mod_mono.h, move the block that #includes those 
headers down into the #else block that executes only for !APACHE13. In 
mod_mono.c, you will also probably have to add an #ifndef block in 
ensure_dashboard_initialized around the whole body of the method.

If you try that, post how it turns out.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Performance improvement in System.Web.HttpWriter

2007-05-14 Thread Joshua Tauberer
Vladimir Krasnov wrote:
> Please approve attached patch that improves performance of HttpWriter.
> It uses GetMaxByteCount in Write and WriteString methods instead of
> GetBytesCount.

I've been meaning to get a patch in to do that. In your patch, though, 
you can even get rid of a string-to-char[] conversion (s.ToCharArray) 
and just pass 'count' to GetMaxByteCount.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono, fast_cgi and configuration.

2007-05-09 Thread Joshua Tauberer
Robert Jordan wrote:
> Joshua Tauberer wrote:
>> Something needs to be figured out about why we are forced into spawning 
>> a dozen m-m-servers (one per Apache child process) at startup.
> 
> When apache's MPM == prefork, apache is spawning a `StartServers'
> amount of children during its initialization. At this time,
> mod_mono is also trying to spawn mod-mono-server, which leads
> to a wild horde of m-m-server process. All m-m-s process but one (the
> winner) will immediately die.
> 
> That's caused by the lack of a decent cross-process locking
> feature in some APR versions. I had a patch for this issue (using
> lock files), but it used to fail when apache's MPM != prefork.
> 
> A workaround is to keep StartServers below 5 (or below an amount
> that doesn't take your server down for a couple of seconds).
> 
>> If the mono process dies, mod_mono should restart it.
> 
> That's problematic for the same reason: lack of a working & reliable
> cross-process locking feature that works with all MPM modules.

Right (I sort of remember the patch). If we can only fix it with the 
latest version of APR and for prefork, we should at least do that. 
That's the default setup in at least Fedora Core, and I imagine elsewhere.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono, fast_cgi and configuration.

2007-05-09 Thread Joshua Tauberer
Ted Milker wrote:
>> Something needs to be figured out about why we are forced into 
>> spawning a dozen m-m-servers (one per Apache child process) at startup.
>>   
> I do not see this behavior on my setup:

Ah, sorry, what I meant was, they are spawned, but all but one 
disappear after a few seconds (the first one to open the Unix socket 
remains, I guess).

And while we're making a list-- easier selection of 1.0/2.0 runtime.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Silverlight early implementation thoughts.

2007-05-09 Thread Joshua Tauberer
Marek Habersack wrote:
> As for ASP.NET 2.0 you mentioned. I don't know if you follow the svn trunk
> development, but there has been a major progress done there.

Actually, although I use mod_mono, I don't use most of ASP.NET 2.0. I 
use an XSLT-based page generation system with a custum IHttpHandler that 
I find much simpler to deal with for what I do. (At least, it seemed 
simpler in the ASP.NET 1.0 days. I don't know the first thing about what 
changed in ASP.NET 2.0.)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono, fast_cgi and configuration.

2007-05-09 Thread Joshua Tauberer
Miguel de Icaza wrote:
> And do people have some thoughts on what we could do to improve
> mod_mono?  Which areas are particularly weak, and what can we do to
> improve it?

Program output (stdout/stderr) should be redirected to something other 
than the main server error log (root access only). Maybe viewable in the 
control panel.

Afair, there are pairs of commands that do the same thing 
(MonoApplications, AddMonoApplications), which is confusing.

The examples on the wiki use Alias, and I never understood why that was 
necessary. That has always confused me.

Failures in the module that yield 500/503s should always send debugging 
info somewhere, and it should send it to somewhere that you don't need 
root access to view. It might also be a good idea to override the 
default response page to include the underlying error that occurred and 
suggested fixes.

It should be possible to have autoconfiguration work and use either A) 
one process for all vhosts or B) a different process for each vhost. 
And, it shouldn't be necessary to turn off autoconfiguration to get 
vhosts to work on their own process.

The notion of a server alias is not clear whether it has scope within a 
vhost or across vhosts.

Something needs to be figured out about why we are forced into spawning 
a dozen m-m-servers (one per Apache child process) at startup.

If the mono process dies, mod_mono should restart it.

I don't think MonoMaxMemory, MonoMaxCPUTime work (last I tried it).

That's just off the top of my head...

These are things I can hack on over the summer, if we're going to 
continue using mod_mono and the design goals re: vhosts can be worked out.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Silverlight early implementation thoughts.

2007-05-06 Thread Joshua Tauberer
Okay, good points all around

Michael Hutchinson wrote:
> On 5/5/07, Joshua Tauberer <[EMAIL PROTECTED]> wrote:
>> But the unpolished things include:
> 
> Most of these are addressed in the upcoming Google Summer of Code...

That might be why they came to mind, since I've read some of the 
descriptions before, but obviously forgot about them.

>>mod_mono (configuration is very awkward, problems are hard to
>> diagnose, restarting the Mono process is still strange)
> 
> FastCGI ASP.NET Server
> http://code.google.com/soc/mono/appinfo.html?csaid=7D9BFE2E183364B9

Okay, I guess that would work. I don't know anything about FastCGI.

>>Class library documentation
>>Doc tools for independent libraries (we need a proper editor GUI)
> 
> WYSIWYG Editor for Monodoc and MonoDevelop
> http://code.google.com/soc/mono/appinfo.html?csaid=69D5900719093384

WYSIWYG is always nice, though I'm not sure that's what I have in mind.

Anyway, if as Jon says, implementing Silverlight is polishing existing 
things, then great. No complaints here.

Miguel de Icaza wrote:
 >>Debugging (MD integration, or *some* GUI debugger)
 >
 > Yes, the issue here is that the debugger has only recently became
 > complete enough to debug applications

I didn't mean to exclude the unpolished nature of the debugger itself 
from that bullet point! :)

(...mod_mono...)
> I guess that part of the problem here is that we never defined a clear
> goal in terms of what the end-user experience was.   Auto-hosting was a
> step in that direction

Right, and the interaction of that and vhosts is still unclear to me. 
(This is besides the point, but while we're here-- I have to add a 
'MonoAutoApplication disabled' on every vhost that uses mod_mono for 
anything to work. I tried to patch this at one point, but the problem 
was exactly as you say, not knowing what the goal was and what the right 
behavior should be.)

> For a while we only had Paolo and Massi working on the JIT, a situation
> that is changing as Zoltan joins the team again, and two new JIT
> developers start in May and June.

Nice!

>>  Runtime performance
> 
> This is not for lack of trying.   

Oh for sure. I also didn't mean to imply that progress hadn't been made. 
Only that based on the benchmarks we see here from time to time, there's 
more that in theory should be possible, so it's one of many things that 
remains in the 'open issues' pile.

I try to follow the blog posts on the optimizations, but often I just 
get very confused!

>> Internal testing of the Web pipelines, by having mono-project.com run 
>> > on the Mono stack
> 
> If someone writes a MediaWiki replacement that is *compatible* with the
> MediaWiki database and rendering interface, am fine switching to it.   

Well, you know that's not going to happen. But there must be some C# 
wiki clones out there by now.

> the sake of Silverlight, for one because a lack
> of Silverlight in Linux would prevent us one day from useful content. 

We all probably thought the same thing about CAS and WPF, if not other 
three-letter acronyms.

Anyway, yeah, you guys are right that some unpolished things are being 
addressed and (apprently) Silverlight isn't a major new thing to 
implement. So all's good.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Silverlight early implementation thoughts.

2007-05-05 Thread Joshua Tauberer
Miguel wrote:
 > Silverlight brings another component into the equation:

Hey,

I don't think I usually chime in on these things, but this time I 
figured I would.

IMO, the Mono community/project tends to spread itself very thin. Lots 
of things get started but not polished up and finished very well. I 
don't think that's always a bad thing --- in fact, the renewed 
enthusiasm that tends to follow new APIs from MS, for instance, is 
really nice to see. And it's certainly not without exception -- 
MonoDevelop is polished, and impressively so despite the fact that it 
continues to undergo significant progress.

But the unpolished things include:

   Debugging (MD integration, or *some* GUI debugger)
   mod_mono (configuration is very awkward, problems are hard to 
diagnose, restarting the Mono process is still strange)
   Class library documentation
   Doc tools for independent libraries (we need a proper editor GUI)

(Some may know that I've taken small stabs at improving the last three 
over the years, and I'm guilty for leaving things in unpolished states.)

Other random things that I think are important:

   The new GC
   Runtime performance
   Was CAS ever finished?
   AOT on 2.0 assemblies (at least for non-generic types)
   Internal testing of the Web pipelines, by having mono-project.com run 
on the Mono stack

And that's just what comes to mind right now. (SWF, ASP.NET 2.0, and 
finishing the existing APIs go without saying.) There are a lot of parts 
of Mono that I've never even touched that I'm sure have unpolished 
aspects too.

Anyway, I'm definitely of the mentality that if you want something done 
in an open source project that's not getting done, you should do it 
yourself. So I'm not trying to sound like I have expectations that all 
of these things should somehow magically just get done.

OTOH, since there are people being paid to work on Mono, it doesn't hurt 
to suggest what I think their priorities should involve---namely, 
polishing existing parts of the project.

And, besides that, before Mono hackers get too involved with an entirely 
new API that may very well flop, I think it would be useful to consider 
whether there are existing parts of the project that need polishing that 
you'd also enjoy working on.

My two cents.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)


Miguel de Icaza wrote:
> Hey folks,
> 
> This is a repost from an internal email that really should have been
> public. 
> 
>    
> 
> Apologies for not sharing with the team my thoughts on Silverlight
> as the conference was unwrapping.   I think folks found out about my
> interest on Silverlight from Martin LaMonica's blog entry.
> 
> Silverlight 1.1 is obviously very aligned with the work that we are
> doing, and if someone is going to implement that it is a natural fit for
> our team to do so.   For one, the majority of the work are the upgrades
> to the 3.5 libraries (System.Core.dll, completing generics, C# 3).
> 
> Today our main goal is to allow a smooth migration of developers
> from Windows to Linux (ok, it is not smooth at all right now, you kind
> of have to be a Unix user to do the transition at all).
> 
> Silverlight brings another component into the equation: a lack of
> Linux/Silverlight will prevent the Linux desktop from getting some
> content.   Whether it will be a big or small issue is yet to be debated,
> but regardless of this, it seems that Silverlight is a lot of fun to
> implement.
> 
> WPF is too big, and there is very little gain, at least in the next
> 3-4 years, because there is no migration strategy for every ISV that has
> invested in Winforms, so the only usage scenarios for WPF were new
> applications, or people that were willing to throw out their investments
> and pretty much start from scratch.
> 
> On the other hand, Silverlight is a tiny subset of WPF, relatively
> easy to implement (a weekend hack, two at most as it has been pointed
> out by some of you) and it will be used to spice up existing web-based
> applications as opposed to rewriting an application.
> 
> 
> Now, we have a bunch of challenges ahead of us, and it is not clear
> when we should start work on a Mono-based Silverlight, I think we should
> but we must:
> 
> * Ship MonoDevelop 1.0, and continue improving it as we wont be
>   a kick-ass development platform until we move beyond
>   Makefiles and debugging with gdb and mdb on the command line.
> 
>   We keep saying Mono is a better development platform, but it 
>   wont be for the unwashed massed until we get this.
> 
> * Ship Windows.Forms and ASP.NET 2.0: there are hundreds of
>   people trying to move their applications to Mono today, and
>   we are going to nee

Re: [Mono-dev] benchmarks mono vs others

2007-04-28 Thread Joshua Tauberer
Dennis Hayes wrote:
>  > Is there an tool or a batch on svn to have a report about performance
> of mono
>  > Versus Ms.NET  implementation.
>  >
> I could not find it real quick, but you can search the archives and 
> probably find it.
> There is a web site that compairs Mono, MS, Java, ect and publishes the 
> results.
> It goes under the name racetrack or racecourse or something like that.
>  
> Maybe some one can reply withthe web site. I think Miguel has bloged 
> about it.

This one?
http://shootout.alioth.debian.org/gp4/csharp.php

(It doesn't compare to MS-- only platforms available on Linux.)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Call for testing - HttpParamsCollection bug

2007-04-23 Thread Joshua Tauberer
Miguel de Icaza wrote:
>> I also encountered a bug in the new HttpParamsCollection, an 
>> IndexOutOfRange because of a failure to account for empty-string param 
>> values.  Patch attached.  Let me know if it's ok to commit.
> 
> It is OK to commit.
> 
> Could you also provide an nunit test case for this regression?

Actually, no.  My source tree is messed up or something, because I keep 
getting:

error CS8019: Can not find the core constructor for type 
`ParamArrayAttribute'

while making corlib.  So I can't compile and test anything at the 
moment.  I actually can't compile the patch I sent earlier, for that 
mattter.  Would someone else mind committing it so I don't commit 
something stupid that doesn't compile, even if it's a ridiculously tiny 
patch? :)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Call for testing - HttpParamsCollection bug

2007-04-22 Thread Joshua Tauberer

Wade Berrier wrote:

Mono 1.2.4 preview sources, packages, and installers are available at:


I also encountered a bug in the new HttpParamsCollection, an 
IndexOutOfRange because of a failure to account for empty-string param 
values.  Patch attached.  Let me know if it's ok to commit.


--
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
Index: System.Web/ChangeLog
===
--- System.Web/ChangeLog	(revision 76060)
+++ System.Web/ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2007-04-22 Joshua Tauberer <[EMAIL PROTECTED]>
+
+	* HttpParamsCollection.cs: Fix IndexOutOfRangeException.
+
 2007-04-17 Igor Zelmanovich <[EMAIL PROTECTED]>
 
 	* HttpException.cs: used GetBaseException() instead InnerException.
Index: System.Web/HttpParamsCollection.cs
===
--- System.Web/HttpParamsCollection.cs	(revision 76060)
+++ System.Web/HttpParamsCollection.cs	(working copy)
@@ -80,7 +80,7 @@
 			if (values == null)
 return null;
 
-			if (values [0] == ',')
+			if (values.Length > 0 && values [0] == ',')
 return values.Substring (1);
 
 			return values;
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Call for testing: -- Timer issue

2007-04-21 Thread Joshua Tauberer
With the 1.2.4 preview, I encountered something with the MySql Connector 
which I narrowed down to an issue with System.Threading.Timer. I don't 
know what the proper way to use the Timer is, so it may be improper use 
on MySql's end, but nevertheless it's unexpected.


When creating and disposing a bunch of timers from various threads, very 
quickly a deadlock (or something near enough) occurs.


I'm attaching a test program. I expect the program to come to 
completion, but inevitably one of the threads gets stuck creating a 
timer. This is on a single-processor x86-32.


(In MySQL, this comes up in the Command Timeout.)

TIA for looking into this for whoever knows about that part of Mono.

- Josh
using System;
using System.Threading;

public class Test {
public static void Main(string[] arg) {
for (int i = 0; i < 10; i++)
new Thread(new Test(i).Runner).Start();
}

int tid;
Timer timer;

public Test(int tid) { this.tid = tid; }

public void Runner() {
Console.Error.WriteLine("Thread {0} Starting", tid);

timer = new Timer(Callback, null, 50, 50);
//timer.Dispose(); // MySQL disposes right away in the usual 
case

Console.Error.WriteLine("Thread {0} Finished", tid);
}

void Callback(object state) {
Console.Error.WriteLine("Callback on Thread: {0}", tid);
timer.Dispose();
}
}
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [Fwd: Re: [Mono-list] New anonymous subversion hostname]

2007-04-20 Thread Joshua Tauberer
Also see:

http://www.mono-project.com/SVN

The feed URLs technically changed since my email in 2005 (actually I 
only updated the wiki recently), but for now the old URLs are 
redirecting to the new ones.

- Josh

John Anderson wrote:
> 
> On 4/19/07, *Wade Berrier* <[EMAIL PROTECTED] 
> > wrote:
> 
> What svn rss feed?  Is that something outside of Novell?
> 
> 
> http://lists.ximian.com/pipermail/mono-devel-list/2005-June/012876.html 
> 
> 
> Wade
> 
> On Thu, 2007-04-12 at 09:57 +0200, Mark IJbema wrote:
>  > Hoping that the person maintining the svn rss feed is on this
> list, will
>  > it be updated to reflect this new url?
>  >
>  > Regards,
>  >
>  > Mark
>  >
>  > On Wed, Apr 11, 2007 at 01:31:41PM -0600, Wade Berrier wrote:
>  > > Notice to all using the anonymous subversion repository:
>  > >
>  > > svn.myrealbox.com  has been renamed
> to anonsvn.mono-project.com 
>  > >
>  > > Wade
>  >
> 
> 
> 
> 
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] monodocs2html help with source

2007-03-01 Thread Joshua Tauberer
Pedro Sobota wrote:
> Hi
>> See tools/stylesheet.xsl.  If a cref attribute is specified, then the
>> value of the cref attribute is used.  If a langword attribute is used,
>> then the value of the langword attribute is used.
>>   
> Right. I hadn't seen the langword match. From what I gather, the cref
> attribute makes for a link with the full type or member name as the
> text, whereas the langword is just output with no link. They seem to be
> mutually exclusive, so I can't link and specify text as well. Maybe for
> the Monodoc format they aren't, in which case this could be repaired for
> monodocs2html?

They have different uses.  langword is used to tag language keywords,
like "null", "true", "false", etc.  cref is to make a link to another
section of the documentation.

The thing to do would be to improve the method for how the text for 's are generated automatically, rather than add a way for the user
to provide his own text.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Monodoc engine crashes um uncompressed help, stopping MD code completion

2007-02-07 Thread Joshua Tauberer
Miguel de Icaza wrote:
>> Don't know what is best for monodoc's engine, to drop uncompressed
>> support altogether or to correct the subclass to override the needed
>> methods. Any bets?
> 
> Drop uncompressed support.  I did not even know we had that.

This is my hack that underlies 'monodoc --edit path' right?  I use that
all the time to edit my own documentation, rather than using a text
editor, so I'd rather you didn't drop it.  I've never had that crash for
me except for when monodocer left the index.xml file in an inconsistent
state.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Patch for mkbundle and embedding Mono

2006-11-29 Thread Joshua Tauberer
Miguel de Icaza wrote:
>> (Btw--- This was for one of the most rapid projects I've ever done.  In
>> 3 hours, I took an existing app with a strange internal scripting
>> language and replaced the scripting language with JavaScript, by
>> convering the Rhino interpreter from Java to .NET (with my favorite tool
>> IKVM), embedding Mono in the native app, and using mkbundle to embed
>> Rhino and other assemblies within the app.  The next step is to get JB's
>> Linker tool to cut down the IKVM libs to just what I need to embed.)
> 
> I love the story;   I think its blog worthy :-)

It'll come up on Monologue shortly with more details.

>> Comments/permission?
> 
> Go ahead.   Just make sure you update mono/man/mkbundle.1 so that its
> documented, and you might want to also update the Wiki ;-)

Good point.  Thanks.

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Patch for mkbundle and embedding Mono

2006-11-29 Thread Joshua Tauberer
o_register_bundled_assemblies((const MonoBundledAssembly **) bundled);
-	return mono_main (argc+1, newargs);
 }
Index: ChangeLog
===
--- ChangeLog	(revision 58921)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2006-11-29  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+	* mkbundle.cs: Added --nomain option to create the host.c file
+	  without a main() function so that it can be used in libraries.
+	* Added: template_main.c, the template for the main() function.
+	* template(_z).c: Factored out the main() method bits and left
+	  a mono_mkbundle_init() function which is called from main(),
+	  or should be called by the user library.
+
 2005-12-29  Robert Jordan  <[EMAIL PROTECTED]>
 
 	* mkbundle.cs, template.c, template_z.c: Added support for Windows.
Index: template.c
===
--- template.c	(revision 58921)
+++ template.c	(working copy)
@@ -1,22 +1,5 @@
-int mono_main (int argc, char* argv[]);
-
-#include 
-
-int main (int argc, char* argv[])
+void mono_mkbundle_init ()
 {
-	char **newargs = (char **) malloc (sizeof (char *) * (argc + 2));
-	int i;
-
-	newargs [0] = argv [0];
-	newargs [1] = image_name;
-	for (i = 1; i < argc; i++)
-		newargs [i+1] = argv [i];
-	newargs [++i] = NULL;
-
-	if (config_dir != NULL && getenv ("MONO_CFG_DIR") == NULL)
-		mono_set_dirs (getenv ("MONO_PATH"), config_dir);
-	
 	install_dll_config_files ();
 	mono_register_bundled_assemblies(bundled);
-	return mono_main (argc+1, newargs);
 }
Index: Makefile
===
--- Makefile	(revision 58921)
+++ Makefile	(working copy)
@@ -4,7 +4,7 @@
 
 PROGRAM = mkbundle.exe
 
-OTHER_RES = template.c template_z.c
+OTHER_RES = template.c template_z.c template_main.c
 
 RESOURCE_FILES = $(OTHER_RES)
 
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] String class speed improvements (UPDATE)

2006-11-26 Thread Joshua Tauberer
Marek Safar wrote:
> Thanks to Paulo's recommendations here is the
> updated version of my original patch.
...
> + while (ptr != end_ptr) {
> + if (*ptr == value_32)
> + return (int)(ptr - start);
> + if (ptr[1] == value_32)
> + return (int)(ptr - start + 1);
> + if (ptr[2] == value_32)
> + return (int)(ptr - start + 2);
> + if (ptr[3] == value_32)
> + return (int)(ptr - start + 3);
> + if (ptr[4] == value_32)
> + return (int)(ptr - start + 4);
> + if (ptr[5] == value_32)
> + return (int)(ptr - start + 5);
> + if (ptr[6] == value_32)
> + return (int)(ptr - start + 6);
> + if (ptr[7] == value_32)
> + return (int)(ptr - start + 7);
> +
> + ptr += 8;
> + }

Can't we get mcs to optimize loops like this rather than putting it in
code?  (Am I right in understanding this as eliminating 7/8ths of the
addition operations?)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Gödel, Escher, Bach" by Douglas Hofstadter)
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Re: mod_mono AutoConfiguration dead

2006-10-21 Thread Joshua Tauberer
Gonzalo Paniagua Javier wrote:
> On Fri, 2006-10-20 at 17:57 -0400, Joshua Tauberer wrote:
>> Chris van Wyk wrote:
>>> I am running a FC4 server relying on mod_mono AutoConfiguration.
>>> Unfortunately this died on me today.
>>>
>>> I am running ver 1.1.18.0 and will appreciate it if someone could give me a
>>> hint on where to start looking for the problem.
>> Having now taken a look at what's happening, I apologize for breaking
>> things.
>>
>> Anyway, I'm attaching a patch that seems like it fixes the problem.  The
>> problem was twofold.  First, virtual hosts seem to not all create a
>> XXGLOBAL (i.e. auto-configuration) mod-mono-server.  On my box, I have
>> XXGLOBAls for all of the virtual hosts in which I've explicitly
>> configured the 'default' entry (where I don't use auto configuration,
>> but the configuration gets applied to the XXGLOBAL entry) but not in the
>> virtual hosts that have no explicit AddMonoApplication directives.  I
>> don't understand why, but so it is.
> [...]
> 
> I realized that because when upgrading go-mono.com the configuration
> failed. I think I fixed it in r66836. Can you tell me if that fixes the
> problem for you too?

No, it doesn't.  In search_for_alias, what I have coming in is alias =
'XXGLOBAL' and server being a vhost, and what has to happen is it has to
match alias=XXGLOBAL/vhost=NULL just when there doesn't exist an xsp for
alias=XXGLOBAL/vhost=hostname.  (Or, we have to ensure we create
separate XXGLOBAL xsp's for each vhost so no fallback would be necessary.)

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] [PATCH] Re: mod_mono AutoConfiguration dead

2006-10-20 Thread Joshua Tauberer
Chris van Wyk wrote:
> I am running a FC4 server relying on mod_mono AutoConfiguration.
> Unfortunately this died on me today.
> 
> I am running ver 1.1.18.0 and will appreciate it if someone could give me a
> hint on where to start looking for the problem.

Having now taken a look at what's happening, I apologize for breaking
things.

Anyway, I'm attaching a patch that seems like it fixes the problem.  The
problem was twofold.  First, virtual hosts seem to not all create a
XXGLOBAL (i.e. auto-configuration) mod-mono-server.  On my box, I have
XXGLOBAls for all of the virtual hosts in which I've explicitly
configured the 'default' entry (where I don't use auto configuration,
but the configuration gets applied to the XXGLOBAL entry) but not in the
virtual hosts that have no explicit AddMonoApplication directives.  I
don't understand why, but so it is.

Second (and this is what changed with my previous patch), now that each
mod-mono-server configuration entry knows which virtual host it was
created by and meant for, requests for pages on one virtual host would
not get handled by mod-mono-servers configured by a different virtual
host.  What was happening before was that virtual hosts with no mono
configuration lines would not have their own XXGLOBAL server created,
and so they would pick up the one created for the main server
configuration.  My change prevented that.

The attached patch makes the following change:

When looking for a mod-mono-server configuration for a particular alias
except the default alias, if such an alias wasn't configured in a vhost,
it will fall back to one configured in the main server configuration.

The effect for the breakage is if you don't do any mod_mono configuring
in a vhost, pages will be served by the XXGLOBAL for the main server
configuration if auto-configuration is enabled.  This is how things were
in 1.1.17.

I expected the patch to allow other aliases besides XXGLOBAL to fall
back, but I couldn't get it to do it...

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 66828)
+++ src/mod_mono.c	(working copy)
@@ -95,12 +95,13 @@
 search_for_alias (const char *alias, module_cfg *config, server_rec *server)
 {
 	/* 'alias' may be NULL to search for the default XSP */
+	/* 'server' may be NULL to search in the main host */
 	int i;
 	xsp_data *xsp;
 
 	DEBUG_PRINT (2, "searching for alias '%s' in server '%s'",
 		alias == NULL ? "" : alias,
-		!server->is_virtual || server->server_hostname == NULL ? "" : server->server_hostname);
+		server == NULL || !server->is_virtual || server->server_hostname == NULL ? "" : server->server_hostname);
 
 	for (i = 0; i < config->nservers; i++) {
 		xsp = &config->servers [i];
@@ -109,7 +110,7 @@
 			xsp->alias == NULL ? "" : xsp->alias,
 			xsp->vhost == NULL ? "" : xsp->vhost);
 
-		if (!server->is_virtual || server->server_hostname == NULL) {
+		if (server == NULL || !server->is_virtual || server->server_hostname == NULL) {
 			if (xsp->vhost != NULL) continue;
 		} else {
 			if (xsp->vhost == NULL) continue;
@@ -123,6 +124,12 @@
 			return i;
 	}
 
+	// If we're not searching for the default alias, and
+	// we're searching in a vhost but didn't find a match,
+	// then search in the main server.
+	if (alias != NULL && server != NULL && server->is_virtual && server->server_hostname != NULL)
+		return search_for_alias(alias, config, NULL);
+
 	return -1;
 }
 
@@ -1443,6 +1450,11 @@
 
 		if (idx == -1) {
 			DEBUG_PRINT (2, "Global config not found. Finishing request.");
+			ap_log_error (APLOG_MARK, APLOG_ERR, STATUS_AND_SERVER,
+"mod_mono was invoked to handle a request for %s with mod-mono-server alias %s but no mod-mono-server is registered to handle such a request",
+r->server->is_virtual && r->server->server_hostname != NULL ? r->server->server_hostname : "",
+alias == NULL ? "" : alias
+);
 			return HTTP_INTERNAL_SERVER_ERROR;
 		}
 	}

Index: ChangeLog
===
--- ChangeLog	(revision 66828)
+++ ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2006-10-20 Joshua Tauberer <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c: I broke AutoConfiguration in vhosts last time (doh).
+	  If there's no XXGLOBAL (or some other non-default alias)
+	  configured in the virtual host, then use one configured in the
+	  main server config.  (Why doesn't each virtual host get one
+	  created?)
+
 2006-10-19 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
 	* src/mod_mono.c: Modified file.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] mod_mono AutoConfiguration dead

2006-10-18 Thread Joshua Tauberer
Chris van Wyk wrote:
> I am running a FC4 server relying on mod_mono AutoConfiguration.
> Unfortunately this died on me today.
> 
> I am running ver 1.1.18.0 and will appreciate it if someone could give me a
> hint on where to start looking for the problem.

If it broke after upgrading to 1.1.18, I imagine the problem is due to
the 'fix' I made for virtual hosts with AddMonoApplications and
AutoConfiguration turned on, which had broken in the previous release.

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Where do I start off??

2006-10-04 Thread Joshua Tauberer
Andrés G. Aragoneses [ knocte ] wrote:
> Michael Schurter escribió:
>> First of all, the mono list is a better place to start as mono-devel is 
>> for developer's working *on* (not *with*) Mono.
> 
> According to [1], that's not strictly true. Citing the page:
> 
>> mono-devel-list: A mailing list specifically dedicated to discussions about 
>> developing Mono and programming *with* Mono.
> (snip)
> [1] http://www.mono-project.com/Mailing_Lists

I just fixed the description on the wiki.  "with" wasn't the right word
(despite the emphasis around it).

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] mod_mono: vhost clashes again

2006-09-17 Thread Joshua Tauberer
The attached patch fixes up some clashes when mod_mono is used with
vhosts.  The XXGLOBAL server socket file must be prefixed with the vhost
name because it is created per-vhost.  The patch prefixes every alias in
a socket file name with the vhost name.  (As a matter of code
cleanliness, it also now uses a more ugly socket file name that includes
the string XXGLOBAL..)

Let me know if it's ok.

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 65551)
+++ src/mod_mono.c	(working copy)
@@ -53,6 +53,7 @@
 
 typedef struct xsp_data {
 	char is_default;
+	char *vhost;
 	char *alias;
 	char *filename;
 	char *run_xsp;
@@ -72,7 +73,6 @@
 	char *env_vars;
 	char status; /* One of the FORK_* in the enum above.
 		  * Don't care if run_xsp is "false" */
-	char is_virtual; /* is the server virtual? */
 } xsp_data;
 
 typedef struct {
@@ -87,16 +87,35 @@
 	char *client_block_buffer;
 } request_data;
 
+static char * get_default_socket_name (apr_pool_t *pool, xsp_data *xsp, const char *base);
+
+
 /* */
 static int
-search_for_alias (const char *alias, module_cfg *config)
+search_for_alias (const char *alias, module_cfg *config, server_rec *server)
 {
 	/* 'alias' may be NULL to search for the default XSP */
 	int i;
 	xsp_data *xsp;
 
+	DEBUG_PRINT (2, "searching for alias '%s' in server '%s'",
+		alias == NULL ? "" : alias,
+		!server->is_virtual || server->server_hostname == NULL ? "" : server->server_hostname);
+
 	for (i = 0; i < config->nservers; i++) {
 		xsp = &config->servers [i];
+
+		DEBUG_PRINT (2, "   found alias '%s' in server '%s'",
+			xsp->alias == NULL ? "" : xsp->alias,
+			xsp->vhost == NULL ? "" : xsp->vhost);
+
+		if (!server->is_virtual || server->server_hostname == NULL) {
+			if (xsp->vhost != NULL) continue;
+		} else {
+			if (xsp->vhost == NULL) continue;
+			if (strcmp(server->server_hostname, xsp->vhost)) continue;
+		}
+
 		if ((alias == NULL || !strcmp (alias, "default")) && xsp->is_default)
 			return i;
 
@@ -115,7 +134,7 @@
 
 	sconfig = ap_get_module_config (cmd->server->module_config, &mono_module);
 	config->alias = (char *) alias;
-	if (search_for_alias (alias, sconfig) == -1) {
+	if (search_for_alias (alias, sconfig, cmd->server) == -1) {
 		char *err = apr_pstrcat (cmd->pool, "Server alias '", alias, ", not found.", NULL);
 		return err;
 	}
@@ -149,19 +168,23 @@
 }
 
 static int
-add_xsp_server (apr_pool_t *pool, const char *alias, module_cfg *config, int is_default, int is_virtual)
+add_xsp_server (apr_pool_t *pool, const char *alias, module_cfg *config, int is_default, server_rec *servercfg)
 {
 	xsp_data *server;
 	xsp_data *servers;
 	int nservers;
 	int i;
 
-	i = search_for_alias (alias, config);
+	i = search_for_alias (alias, config, servercfg);
 	if (i >= 0)
 		return i;
 
 	server = apr_pcalloc (pool, sizeof (xsp_data));
 	server->is_default = is_default;
+	if (!servercfg->is_virtual || servercfg->server_hostname == NULL)
+		server->vhost = NULL;
+	else
+		server->vhost = apr_pstrdup(pool, servercfg->server_hostname);
 	server->alias = apr_pstrdup (pool, alias);
 	server->filename = NULL;
 	server->run_xsp = "True";
@@ -182,7 +205,6 @@
 	server->debug = NULL;
 	server->env_vars = NULL;
 	server->status = FORK_NONE;
-	server->is_virtual = is_virtual;
 
 	nservers = config->nservers + 1;
 	servers = config->servers;
@@ -214,7 +236,7 @@
 	config = ap_get_module_config (cmd->server->module_config, &mono_module);
 	if (second == NULL) {
 		if (config->auto_app) {
-			idx = search_for_alias ("XXGLOBAL", config);
+			idx = search_for_alias ("XXGLOBAL", config, cmd->server);
 			ptr = (char *) &config->servers [idx];
 			ptr += offset;
 			value = first;
@@ -233,8 +255,6 @@
 			return NULL;
 		}
 		alias = "default";
-		if (cmd->server->is_virtual)
-			alias = cmd->server->server_hostname;
 		value = first;
 		is_default = 1;
 	} else {
@@ -249,9 +269,9 @@
 	if (!config->auto_app_set)
 		config->auto_app = FALSE;
 
-	idx = search_for_alias (alias, config);
+	idx = search_for_alias (alias, config, cmd->server);
 	if (idx == -1)
-		idx = add_xsp_server (cmd->pool, alias, config, is_default, cmd->server->is_virtual);
+		idx = add_xsp_server (cmd->pool, alias, config, is_default, cmd->server);
 
 	ptr = (char *) &config->servers [idx];
 	ptr += offset;
@@ -310,12 +330,6 @@
 	return cfg;
 }
 
-static char *
-get_de

Re: [Mono-dev] [PATCH] Small SqliteClient improvments.

2006-09-13 Thread Joshua Tauberer
Jb Evain wrote:
> Miguel de Icaza wrote:
>>> The attached patch implements the GetBytes method for SqliteDataReader
>>> and also converts enums to integer automatically when saving the data
>>> to DB.
>>>
>>> Is it ok to commit?
>> Joshua approved it.
> 
> Isn't there is a problem with the handling of enums when their 
> underlying type is not an Int32?

Heh, ok, we even had a Cecil-related discussion about that and I still
didn't catch it.

Probably Convert.ToInt64(value) will do the trick.

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Small SqliteClient improvments.

2006-09-13 Thread Joshua Tauberer
Miguel de Icaza wrote:
>> The attached patch implements the GetBytes method for SqliteDataReader
>> and also converts enums to integer automatically when saving the data
>> to DB.
>>
>> Is it ok to commit?
> 
> Joshua approved it.

How mysterious.  :)  Like I'm just pulling the strings behind the scenes.

(Actually I just have been avoiding posting to the list with my new
email address in fear of the onslaught of spam.)

-- 
- Joshua Tauberer

http://razor.occams.info

"Strike up the klezmer and start acting like a man. You're
about to have a truth-mitzvah."  -- The Colbert Report
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Make mod_mono restart mod-mono-server

2006-05-30 Thread Joshua Tauberer
Kornél Pál wrote:
> When mono crashes for example because of a missing assembly
> mod-mono-server will not be restarted automatically that causes Service
> Unavailable error pages.
> 
> The attached patch restarts mod-mono-server if the socket cannot be opened.
> 
> This solution may not be the best but I think there is a need for
> something like this.

I agree.

IIRC, the reason we don't do that now is that if you have a lot of
incoming requests and mod-mono-server takes some time to start, you'll
get a lot of forked mono processes -- from each request until one
mod-mono-server gets to the point of accepting connections.

Ideally what would be good would be to have some form of flag visible
across the apache child processes to ensure that only one m-m-s gets
started when it is not running -- possibly a file with a timestamp of
the last start attempt, or something.

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] What would you like to see in Mono?

2006-03-30 Thread Joshua Tauberer
Daniel Morgan wrote:
> 1. I would love to see a fully managed CLI runtime.

A Cecil-powered interpreter or JIT (via DynamicMethod)?  That sounds
really fun.

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Creating fewer objects (Sys.Xml, Sys.Web)

2006-03-27 Thread Joshua Tauberer
Atsushi Eno wrote:
> Joshua Tauberer wrote:
>> (My patch was cooler!)
> 
> Well, I have to say, it was beyond my expectation for me ;-)
> On which part was your patch cooler? I don't think
> specific-implementation-dependent code (internal AddQName) is good,
> and more importantly, after your code future hackers would feel
> reluctant to improve NameTable since your patch adds extra one
> to care.

Ok, ok, you win. :)

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Creating fewer objects (Sys.Xml, Sys.Web)

2006-03-27 Thread Joshua Tauberer
Atsushi Eno wrote:
> I'd prefer different approach so that 1) XmlNameEntry does not
> have to become fat boy and 2) keep code cleaner. How about
> the attached one? It avoids extra string creation as well.

Certainly works for me.  (My patch was cooler!)

(And: I don't know if it was necessary, but XmlElement was checking if
prefix == null which you're not checking for in your patch.)

Thanks.

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Creating fewer objects (Sys.Xml, Sys.Web)

2006-03-27 Thread Joshua Tauberer
Atsushi & Gonzalo (and anyone else),

Attached are two patches to reduce new object creations.

In Sys.Xml, I cut out string concatenations in XmlElement.Name and
XmlAttribute.Name.  The (prefix + ":" + localname) concatenation
occurred even if the final string was already in the NameTable.  To
avoid this, I added a method to NameTable (an internal class) to accept
a prefix and localname separately for checking if the final concatenated
string would be in the name table already.  The only performance hits
might come from calls to the 'is' operator and two calls to
String.CompareOrdinal rather than a single call to Equals.

In Sys.Web.HttpWriter, a byte[] is created on each call to Write for
strings and char arrays.  Instead, I reuse and resize a byte[] array
kept by the class.  Since HttpWriter isn't thread safe, this seems ok.
The downside is that string encoding is done through two calls, once to
get the byte count and then to get the bytes.  I don't know what kind of
performance impact that might have.

These changes reduce the two biggest object allocators per request for
my ASP.NET site.  My hope is that this will cut down on the runaway
memory allocation that I'm still facing and hopefully have no
significant performance cost.  But I don't know about either.

I'll try the patches out for a while to make sure I didn't goof anything up.

Thanks guys.

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
Index: ../System.Web/System.Web/ChangeLog
===
--- ../System.Web/System.Web/ChangeLog	(revision 58623)
+++ ../System.Web/System.Web/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2006-03-27 Joshua Tauberer <[EMAIL PROTECTED]>
+
+	* HttpWriter.cs: Avoid creation of a byte[] on each Write()
+	  by reusing and resizing a private array.
+
 2006-03-23 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
 	* HttpResponse.cs: more fixes for CacheControl: MS allows to set it to
Index: ../System.Web/System.Web/HttpWriter.cs
===
--- ../System.Web/System.Web/HttpWriter.cs	(revision 58623)
+++ ../System.Web/System.Web/HttpWriter.cs	(working copy)
@@ -42,6 +42,8 @@
 		HttpResponseStream output_stream;
 		HttpResponse response;
 		Encoding encoding;
+		
+		byte[] bytebuffer = new byte[2048];
 
 		internal HttpWriter (HttpResponse response)
 		{
@@ -97,23 +99,20 @@
 		
 		public override void Write (string s)
 		{
-			if (s == null)
-return;
-			
-			byte [] xx = encoding.GetBytes (s);
-
-			output_stream.Write (xx, 0, xx.Length);
-			
-			if (response.buffer)
-return;
-
-			response.Flush ();
+			WriteString (s, 0, s.Length);
 		}
 		
 		public override void Write (char [] buffer, int index, int count)
 		{
-			byte [] xx = encoding.GetBytes (buffer, index, count);
-			output_stream.Write (xx, 0, xx.Length);
+			/*byte [] xx = encoding.GetBytes (buffer, index, count);
+			output_stream.Write (xx, 0, xx.Length);*/
+			
+			int length = encoding.GetByteCount (buffer, index, count);
+			if (length > bytebuffer.Length)
+bytebuffer = new byte[length << 2];
+			encoding.GetBytes (buffer, index, count, bytebuffer, 0);
+			
+			output_stream.Write (bytebuffer, 0, length);
 
 			if (response.buffer)
 return;
@@ -135,12 +134,22 @@
 
 		public void WriteString (string s, int index, int count)
 		{
-			char [] a = s.ToCharArray (index, count);
+			if (s == null)
+return;
 
-			byte [] xx = encoding.GetBytes (a, 0, count);
+			int length;
+			if (index == 0 && count == s.Length) {
+length = encoding.GetByteCount (s); 
+			} else {
+char [] chars = s.ToCharArray(index, count);
+length = encoding.GetByteCount (chars);
+			}
+			if (length > bytebuffer.Length)
+bytebuffer = new byte[length << 2];
+			encoding.GetBytes (s, index, count, bytebuffer, 0);
 			
-			output_stream.Write (xx, 0, xx.Length);
-
+			output_stream.Write (bytebuffer, 0, length);
+			
 			if (response.buffer)
 return;
 
Index: System.Xml/XmlElement.cs
===
--- System.Xml/XmlElement.cs	(revision 58622)
+++ System.Xml/XmlElement.cs	(working copy)
@@ -179,10 +179,7 @@
 
 		public override string Name {
 			get {
-if (name.Prefix == String.Empty || name.Prefix == null)
-	return name.LocalName;
-else
-	return OwnerDocument.NameTable.Add (name.Prefix + ":" + name.LocalName);
+return name.GetQName (OwnerDocument.NameTable);
 			}
 		}
 
Index: System.Xml/XmlNameEntry.cs
===
--- System.Xml/XmlNameEntry.cs	(revision 58622)
+++ System.Xml/XmlNameEntry.cs	(working copy)
@@ -52,6 +52,8 @@
 		public string LocalName;
 		public string NS;
 		public in

Re: [Mono-dev] PtrToStringAnsi

2006-03-09 Thread Joshua Tauberer
Atsushi wrote:
> Mono does not support non-UTF8 multibyte conversion by design.

That's ok, but whatever we marshal out we should be able to marshal
back, yeah?

Okay, so after some more digging and realizing things are more
complicated than I thought, here's what I've learned:

PtrToStringAnsi does a UTF-8-to-UTF-16 conversion

StringToHGlobalAnsi does exactly the reverse

StringToCoTaskMemAnsi does something totally different!  It does
something kind of like a conversion to ANSI (or maybe it is ANSI, I'm
not sure).  There's no way to marshal such pointers back.

While the Ptr and HGlobal methods are icalls, the CoTaskMem methods are
in C#.

My confusion yesterday came from my assumption that
StringToCoTaskMemAnsi was simply wrapping StringToHGlobalAnsi, whose
implementation I was looking at.  StringToHGlobalAnsi eventually calls
the glib conversion function, and so I was expecting to see UTF-8 in the
resulting bytes whereas I was only seeing ANSI.

Anyway, I think StringToCoTaskMemAnsi should be changed to do exactly
the same thing as StringToHGlobalAnsi, right?  StringToCoTaskMemUni also
has a managed implementation, and while it looks OK, it strangely also
doesn't reuse the implementation of StringToHGlobalUni.

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."

Atsushi Eno wrote:
> Hello,
> 
> Mono does not support non-UTF8 multibyte conversion by design. We
> shouldn't change its behavior from current one. Actually it is pretty
> classic matter which has been stated since 2003.
> http://lists.ximian.com/archives/public/mono-list/2003-June/014500.html
> 
> It is Microsoft who should provide additional marshaling flags so that
> it will be truly functional on every platforms (especially considering
> that there is also Gtk+ on Windows which is apparently designed to work
> on Windows and uses UTF-8 based marshaling). AFAIK they are also aware
> on this matter through ECMA meetings.
> 
> Atsushi Eno
> 
> 
>> While debugging a SqliteClient issue, I came across an interesting bug.
>>  The following returns null when I'm pretty sure it should not (it
>> doesn't on Windows):
>>
>> Marshal.PtrToStringAnsi(Marshal.StringToCoTaskMemAnsi("ü"))
>>
>> In case the encoding of this email gets messed up, that's a u with
>> umlauts, (char)0xFC.
>>
>> The encoding half "works" (Marshal.ReadByte reports the bytes (0xFC
>> 0x00)), on the assumption that I'm supposed to get ANSI out of this
>> method.  Internally, g_utf16_to_utf8 is used, which means that (besides
>> being surprised this call doesn't actually do ANSI encoding) I would
>> actually expect a multibyte representation of that character.  That's
>> from a few minutes of Googling for info on UTF-8.
>>
>> So I'm confused.  Can someone with more knowledge about encodings tell
>> me whether this really doesn't make sense?
>>
>> I'm using the latest RPMs.  Here's a test program:
>>
>> using System;
>> using System.Runtime.InteropServices;
>>
>> public class Test {
>> public static void Main()
>> Console.WriteLine(Marshal.PtrToStringAnsi(Marshal.StringToCoTaskMemAnsi("ü")));
>>  }
>> }
>>


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Compiling monodoc

2006-03-09 Thread Joshua Tauberer
Paul F. Johnson wrote:
> Just building monodoc and it's reporting that the type or namespace
> "Cecil" does not exist in the workspace "mono" - is this me or a problem
> in svn?

A problem in SVN... sorry

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] PtrToStringAnsi

2006-03-08 Thread Joshua Tauberer
While debugging a SqliteClient issue, I came across an interesting bug.
 The following returns null when I'm pretty sure it should not (it
doesn't on Windows):

Marshal.PtrToStringAnsi(Marshal.StringToCoTaskMemAnsi("ü"))

In case the encoding of this email gets messed up, that's a u with
umlauts, (char)0xFC.

The encoding half "works" (Marshal.ReadByte reports the bytes (0xFC
0x00)), on the assumption that I'm supposed to get ANSI out of this
method.  Internally, g_utf16_to_utf8 is used, which means that (besides
being surprised this call doesn't actually do ANSI encoding) I would
actually expect a multibyte representation of that character.  That's
from a few minutes of Googling for info on UTF-8.

So I'm confused.  Can someone with more knowledge about encodings tell
me whether this really doesn't make sense?

I'm using the latest RPMs.  Here's a test program:

using System;
using System.Runtime.InteropServices;

public class Test {
public static void Main()   
Console.WriteLine(Marshal.PtrToStringAnsi(Marshal.StringToCoTaskMemAnsi("ü")));
}
}

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] SqliteDataReader should handle getting field type for null values

2006-03-07 Thread Joshua Tauberer
Kamil Skalski wrote:
> I encountered NullReferenceException from SqliteDataReader, when I
> have a query like
> 
> select a, b, NULL, c, FROM xxx
> 
> and I try to use reader.GetFieldType (2) for fetching info about
> columns (actually DataAdapter from MS.NET calls this method for every
> column in result)
> 
> I attach a patch (test included) for fixing this. It works great in my
> app and it would be nice to have it official :)
> 
> May I commit?

Please do!

I'm wondering, tho, if wherever the adapter would return null, it should
return a DBNull instead?  Do other data adapters ever return 'null' values?

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Current state of documentation?

2006-02-27 Thread Joshua Tauberer
Jb Evain wrote:
>> We're waiting (or at least I was) for Cecil to support generics before
>> documenting the .NET 2.0 libraries.
> 
> Cecil can read .net 2.0 assemblies, and already have generics support
> (it is used inside the debugger).

In that case, someone (me, I guess) better update monodocer!

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Current state of documentation?

2006-02-27 Thread Joshua Tauberer
For future reference, mono-docs-list is the right place for these
questions.  (Anyone replying should now reply on that list and not
mono-devel-list.)  On to my reply:

Hi, Brian,

Brian Crowell wrote:
> I've checked out the monodoc project from AnonSVN, but I'm not sure if
> it's being used. The contents of the various XML files don't match those
> on the website, unless there's some special translation for anything
> marked "To be added".

Actually, there is.  Miguel pointed out some time ago that "To be added"
made it seem like the implementation, rather than the documentation, is
missing.  So it replaces that on the fly with whatever it actually says.

Sometimes the web version falls out of date with what's in SVN, but that
should be the only difference.

> 1. What is being used from this project, and should it be updated in its
> present form?

The monodoc documentation should be updated, yes.

We're waiting (or at least I was) for Cecil to support generics before
documenting the .NET 2.0 libraries.

> 2. Who is currently watching over this?

Miguel, from the official side of things, but various other people on
mono-docs-list have stepped up to watch over things as well.

> 3. Would it be helpful (and/or legal) to update the Mono doc set with
> the documentation from the ECMA specs? (I can't find a notice from the
> ECMA site that says either way.) If not, what other way could the
> documentation for the base classes be updated?

Unless the ECMA docs have been released under an open-source-ish
license, they're copyrighted and can't be 'imported' without permission
from the copyright holder.  I don't know if they're licensed at all.

The other way to update docs is for people to write them. :)  Really,
the best people to write docs are the people that have had a hand in the
implementation of the class libraries.  (Nudge nudge.)  But the rest of
us really ought to do some writing too, either through the Monodoc Gtk#
app, or via editing the XML files directly and committing or submitting
a patch to mono-docs-list.

-- 
- Joshua Tauberer

http://taubz.for.net

"Unfortunately, we're having this discussion. It's too bad,
because guess who listens to the discussion: the enemy."
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Support for blobs in SQLite

2006-01-23 Thread Joshua Tauberer
[EMAIL PROTECTED] wrote:
> As far as I know there is no way to insert blobs using the SQLite
> provider included in mono. I've checked the latests sources and I can't
> find the code handling this kind of paramenter.
...
> Can somebody add these 4 lines in the next release???

Yep.  Thanks for pointing it out.

-- 
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Problem with sqlite in mono 1.1.13

2006-01-22 Thread Joshua Tauberer
Aaron Bockover wrote:
> Attached is a patch that will return an Int64 for INTEGER columns unless
> the value can fit in an Int32, in which case it will return an Int32.
> Also changed from DateTime.Parse to DateTime.ParseExact. I'm not sure if
> I'm doing the proper thing with the culture. I'm pretty sure it returns
> UTC.

Why do you say that dates are in "-MM-dd HH:mm:ss" format?  It
depends on how they were put into the database -- probably the local
encoding if they're put in with DateTime.ToString(), right?

Also, checking if the long fits into an int, the negative lower bound
has to be checked too, I guess.  (Don't worry about resending a patch
just for that tho.)

-- 
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Problem with sqlite in mono 1.1.13

2006-01-22 Thread Joshua Tauberer
Aaron Bockover wrote:
> Wow. I'm not sure why this change was made, but in
> Mono.Data.SqliteClient/SqliteDataReader.cs, this happens now for columns
> declared as INT/INTEGER:

There was some confusion, I think either in bugzilla or on the mail
lists, about DATETIME columns returning strings or something, so I
figured that if you've declared a column as an INTEGER or DATETIME,
that's probably the type of data you're going to be putting into it.
Except, I realize now that there's no BIGINT equivalent in Sqlite.

It was sort of a compromise between doing what one would expect of any
data adapter versus doing exactly what Sqlite does.

So... I'll undo that.  Do you think I should also undo string conversion
to DateTime for DATETIME columns?

-- 
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **



> 
> ...
> data_row[i] = (int)Sqlite.sqlite3_column_int64 (pVm, i);
> ...
> 
> An explicit cast from an Int64 to an Int32. So that change completely
> breaks compatibility with older databases.
> 
> A local fix for you is to use the NUMBER column type instead of INTEGER
> if you need to store an Int64, though I do not agree with this change,
> and I bet this breaks my application too:
> 
> 2006-01-02  Joshua Tauberer  
> ...
> * SqliteDataReader.cs:
> * Use object[] in place of ArrayList for each row.
> * For Sqlite3, which remembers whether a value was
>   an integer, text, real, or blob, actually return
>   longs, strings, doubles, and byte[]s.
> * GetDataTypeName() works where possible (Sqlite3).
> * INT/INTEGER columns are now returned as ints,
>   rather than longs, for Sqlite3.  Similarly for
>   DATE and DATETIME columns, now returning DateTimes.
> 
> I'll do some more probing of this issue.
> 
> Cheers,
> Aaron Bockover
> 
> 
> On Sun, 2006-01-22 at 22:49 +0100, Fredrik Nilsson wrote:
>> Sorry, forgot to attach output of testcase:
>>
>> Value to store: 127824400782036290
>> Value in database: -2109895358
>>
>> /Fredrik Nilsson
>>
>>
>> Fredrik Nilsson wrote:
>>> Hi,
>>>
>>> I'm having problem with sqlite since mono version 1.1.13.
>>> Getting a long (Int64) value doesn't work anymore.
>>> I didn't have any problems with this in version 1.1.12.
>>>
>>> Small test case will follow.
>>>
>>> /Fredrik Nilsson
>>>
>>>
>>> using System;
>>> using Mono.Data.SqliteClient;
>>>
>>> class MainClass
>>> {
>>>public static void Main(string[] args)
>>>{
>>>long filetime = DateTime.Now.ToFileTime ();
>>>
>>>Console.WriteLine ("Value to store: " + filetime);
>>>   SqliteCommand cmd = new SqliteCommand();
>>>SqliteConnection connection = new 
>>> SqliteConnection(@"version=3,URI=file:test.db");
>>>connection.Open();
>>>cmd.Connection = connection;
>>>cmd.CommandText = "CREATE TABLE Test (Date INTEGER NOT NULL);";
>>>cmd.ExecuteNonQuery ();
>>>
>>>cmd = new SqliteCommand ();
>>>cmd.Connection = connection;
>>>cmd.CommandText = "INSERT INTO Test (Date) VALUES ('" + 
>>> filetime + "');";
>>>cmd.ExecuteNonQuery ();
>>>
>>>cmd = new SqliteCommand ();
>>>cmd.Connection = connection;
>>>cmd.CommandText = "SELECT * FROM Test;";
>>>SqliteDataReader reader = cmd.ExecuteReader ();
>>>   while (reader.Read ()) {
>>>Console.WriteLine ("Value in database: " + reader[0]);
>>>}
>>>   connection.Close();
>>>}
>>> }
>>> ___
>>> Mono-devel-list mailing list
>>> Mono-devel-list@lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>
>> ___
>> Mono-devel-list mailing list
>> Mono-devel-list@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] gacutil problem

2006-01-11 Thread Joshua Tauberer

Jonathan Pryor wrote:

Extending /r to do GAC lookups couldn't be simulated at all with CSC.


Ok, fair point.  I don't remember that one being mentioned before.  So 
if you're in Windows, giving a file path is a good idea so you can 
switch between the compilers.  But, if you're giving Unix file paths to 
build in Unix, you're going to have to do something different to build 
on Windows anyway.



Extending /r would also be ugly-as-hell (the /r reference would require
the public key token and major.minor version at minimum), e.g. 


mcs "/r:gtk-sharp, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f"


I don't see what's wrong with that, really.  I *want* my build to fully 
specify its dependencies.  And for people who don't need to worry about 
others running their builds, a partial assembly name is just fine.



See also:
http://lists.ximian.com/pipermail/mono-devel-list/2004-May/005294.html
http://lists.ximian.com/pipermail/mono-devel-list/2004-May/005227.html


Yeah, I was around for those.  I even suggested this then, but no one 
seemed to like the idea.  :)


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] gacutil problem

2006-01-10 Thread Joshua Tauberer

Paul F. Johnson wrote:

I've compiled the MySQL connector and have run gacutil -i MySql.Data.dll
which gacutil reports has been installed into the gac
(/usr/lib/mono/gac).

When I try to compile using it thought, I get the error that mcs cannot
find the assembly MySql.Data.


Something about mcs not using the GAC to find assemblies, but only 
looking at 'installed' packages with .pc files, or in 
/usr/lib/mono/1.0/.  You could specify the full path, or use -L.


Could we reevaluate exactly why we avoid using the GAC at compile time? 
 Lots of people have been confused by this behavior, I still don't 
understand how looking in particular places besides the GAC is any 
better than additionally looking in the particular place named the GAC. 
 If the developer is concerned about the version of the assembly found, 
he should be able to put the version in the /r option, and not rely on 
the right version (and no other version) actually being 'installed'.


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] good IDE tool to work with MONO source codes in Linux?

2005-12-10 Thread Joshua Tauberer

Felipe Almeida Lessa wrote:

Also maybe support for CVS/SVN, but AFAIK MonoDevelop doesn't handle this yet.


There is a plugin ('Version Control') that does many/most SVN things.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] Mono.Data.SqliteClient fixes from Beagle

2005-11-29 Thread Joshua Tauberer

Daniel Drake wrote:
Previously, SqliteClient did not properly check the return values of 
some of its calls into the sqlite API.


In light of the issue on mono-list about a "CREATE TABLE ...; CREATE 
TABLE ...;" command, if my hasty conclusion was true that we can't 
prepare the whole thing before executing, and in which case 
SqliteCommand.cs needs to be rewritten, it might be better to hold off 
on modifying that file until after.  At least, if I'm going to do the 
rewriting, that's my preference.  But I won't have time to do that for a 
few weeks, so if you or anyone else wants to work on that before then, 
just ignore my opinion. :)


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Questions about each site getting a mono process/503 errors

2005-11-14 Thread Joshua Tauberer

Christopher Bergström wrote:

I can get vhosts to work.. I can't get vhosts to work with each site on
their own process.


What I said will put each vhost on its own process.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Questions about each site getting a mono process/503 errors

2005-11-14 Thread Joshua Tauberer

Christopher Bergström wrote:

I've read that documentation 10x and even just a few minutes ago to see
if there was any revisions..  You may* be able to get a subdirectories
working their own
process, but I have yet to get it working with domains..


Okay, I got a little lost in all of the things you tried.  In my 
configuration: I don't have any Mono directives outside of vhosts, and 
the only directive I have in each vhost is

MonoApplications "/:/path/to/site"

Don't bother with aliases ('example') unless you want more than one 
mod-mono-server in a vhost.  When you use aliases, you need to also use 
MonoSetServerAlias.


I think that'll fix the problem.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Questions about mod-mono-server process/AppDomain loading/unloading

2005-11-13 Thread Joshua Tauberer

Christopher Bergström wrote:

Is there any current way to put each site on it's own process? ( I think
this might be key to a temp solution if it's _easy_)


Manually, following www.mono-project.com/Mod_mono.

Which files do the heavy lifting for loading/unloading of AppDomain(s). 
I'm going to guess this isn't documented so I'm curious to look at the

source and how loading/unloading is currently done.


Heh, I have no idea.  It's a complicated issue.  Probably only the 
runtime guys really understand the problem. :)


> Does MS document
> how they do it anywhere and do we currently follow suite currently?

It's an issue specific to the design of mono's internals.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] mod_mono: startup problems with Apache 1.3

2005-11-13 Thread Joshua Tauberer
Better than what I was saying about reading pids from files, you could 
use APR's cross-process mutexes:


http://docx.webperf.org/group__apr__proc__mutex.html

Just put a lock around the forking+sleeping-a-bit.  I think that'll cut 
out the simultaneous spawning pretty easily.


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Quick question about new features in mono control panel

2005-11-13 Thread Joshua Tauberer

Christopher Bergström wrote:

Here's what I outline and I think would be great.. (Feedback welcomed)



A) Either updates to bin/*.dll or web.config not requiring a restart of
Mono process


Figuring out when the files change is not a problem, but...


B) Some way to restart each site and not have it effect the other sites


Besides restarting a mod-mono-server process, as I said, there's no way 
to restart individual applications.  This has to do with complicated 
AppDomain unloading issues.



(esp not clearing their cache.  That can be a big performance hit if it
happens too often.)


I don't think that's possible, not for caching in general.  Cached 
objects in memory can't stick around if the whole application is being 
restarted.



i. Even _if_ each site ran under it's own mono process that would be
fine so long as we can achieve the above goal.. Note: This only applies
to servers that don't have an insane amount of sites.


Well this is possible, as we know, except not automatic.

Pending the ability for applications to be unloaded/restarted, we could 
add something that automatically restarts a mod-mono-server when 
particular files are updated.  (But note that this involves a policy 
decision too, because you wouldn't necessarily want someone to be able 
to restart everyone's applications just by recompiling.)



ii. We would probably need two tiers of Mono control panel. (Call
them GlobalMonoCtl MonoCtl)


Okay, I'll think about how to do something like that.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Quick question about new features in mono control panel

2005-11-13 Thread Joshua Tauberer

Christopher Bergström wrote:

(Also if I enable /mono for all sites.. wouldn't this allow all sites to
restart all the server processes and not just their own?)


Yes, but you can add Apache access control as needed.


There needs to be a more fine grained control over this 


Ah, what I meant was you can control access to the "mono/?restart=..." 
URLs that when accessed actually do the restarting, so you can control 
which links are functional in that way.


Anything more is probably going to be based on a local policy decision. 
 We could add a tool of some sort to make this all easier, but since I 
don't know what kind of tool would be useful for sysadmins, I wouldn't 
know what to make.



(Will this also enable per site caching to be
restarted as well?)


The whole process is restarted, so anything kept in memory is cleared.

(And, I don't know the answers to your other questions.)

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] [PATCH] mod_mono: startup problems with Apache 1.3

2005-11-12 Thread Joshua Tauberer

Robert Jordan wrote:

The attached patch fixes the problem by not starting
xsp from apache's child_init handler. It's now started
on demand during the first request.


How about something more 'creative' to only start mod-mono-server once. 
 One of the preforked processes should decide that it's going to be the 
one to do the initial forking.  I can't find a way for a child process 
to figure out if it's, e.g., the first-spawned process, but that would 
be a nice way to do it.


Or, they can all check for the presence of "/tmp/mod_mono-forker" (or 
some name determined by the pid of the main apache process?), read a pid 
in it, if the pid is valid then it's the pid of the process doing 
forking, otherwise write its own pid in it and do forking (with all of 
that locked properly, and deleting the file on shutdown).


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] RE: Mono website down ?

2005-10-11 Thread Joshua Tauberer

For me, the output of 'dig www.mono-project.com' shows:
www.mono-project.com.   97311   IN  CNAME   redirector.novell.com.
redirector.novell.com.  17436   IN  A   130.57.4.70

And as expected, I don't see the Mono homepage when I go to that url. 
If Novellites haven't figured it out yet, I hope that will help them 
figure out what's up.


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] (Nevermind) Asp.net thread abort issue

2005-10-10 Thread Joshua Tauberer

Gonzalo Paniagua Javier wrote:

On Sun, 2005-10-09 at 08:04 -0400, Joshua Tauberer wrote:

Gonzalo Paniagua Javier wrote:
  > Anyway, if you ever decide to catch ThreadAbortException anywhere in the

asp.net pipeline, bear in mind that it's used also when the configured
timeout is reached.

The timeout for what?


For the maximum request processing time set in machine.config/web.config
(httpRuntime/executionTimeout).


Ahha.

For instance, if you abort the thread within a method called by 
reflection, when Invoke() finishes the exception is a 
TargetInvocationException and not a ThreadAbortException, confusing my 
catch clauses higher up.

Yes, the behavior is right. However, a ThreadAbortException should be
rethrown after the finally clause, even when catched, if ResetAbort() is
not called.


The thing I was getting at is that you can't rely on catching 
ThreadAbortException to detect if Response.Redirect was called or if the 
processing has timed out -- the exception might be wrapped in another 
exception if the code executing at the time the exception was thrown was 
called with reflection.


All of the ThreadAbortException catches in HttpApplication, for 
instance, are potential problems.  Instead, you probably need to check

  (Thread.CurrentThread.ThreadState & ThreadState.AbortRequested) != 0
in every catch block.

What has been particularly strange, though, is the ThreadAbortExceptions 
appears to be thrown later on again after the first exception burried 
inside another exception was caught and ignored (without ResetAbort 
being called).  I think this is something I experienced (but couldn't 
reproduce in a small exe), and looks to be what's happening in the 
recent mono-list post "ASPX page randomly crashes."  (Well, maybe.)


Meanwhile, I found 1.1.8 RPMs on my box (I realized this morning that 
yum nicely keeps old RPMs hanging around a while) and went back to that, 
and my site is working smoothly again.  I think we need more advanced 
regression testing. :)  (That or my site was somehow relying on a bug 
that was fixed after 1.1.8.)  I don't know how I can help find the 
problems without taking my site down, though.


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Can't find older binaries

2005-10-09 Thread Joshua Tauberer
Can someone point me to the location of RPMs for 1.1.8? 
http://mono-project.com/OldReleases only has broken links since that 
release.


Despite getting around the ThreadAbort issue, I'm having other mod_mono 
problems that I can't track down, and I'm not sure when they started 
since I don't remember what RPM release I was using before 1.1.9.  Three 
problems seem to crop up after a few minutes of serving pages: Either 
'Service unavailable', 'Internal server error', or the request just 
hangs indefinitely.  I've spent the day so far adding debugging output 
to mod_mono, mod-mono-server and my own dll, and I can't pin down what's 
happening.


Blegh.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] (Nevermind) Asp.net thread abort issue

2005-10-09 Thread Joshua Tauberer

Gonzalo Paniagua Javier wrote:
 > Anyway, if you ever decide to catch ThreadAbortException anywhere in the

asp.net pipeline, bear in mind that it's used also when the configured
timeout is reached.


The timeout for what?

This ThreadAbortException business is quite something to get a handle 
on.  For instance, if you abort the thread within a method called by 
reflection, when Invoke() finishes the exception is a 
TargetInvocationException and not a ThreadAbortException, confusing my 
catch clauses higher up.  Is that the right behavior?  It also doesn't 
do the usual automatic re-throwing of the ThreadAbortException after 
catch clauses, so the thread goes on if the exception is caught at any 
point.


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] XmlTextReader bug

2005-10-08 Thread Joshua Tauberer
I think this is an issue.  Hopefully it won't be my second false alarm 
today.


In XmlTextReader, SkipTextDeclaration attempts to skip over the xml 
declaration.  If it encounters a processing instruction that starts with 
the three letter 'xml', for instance 'xml-stylesheet', it bails.  The 
attached patch makes sure it only rejects PI names that are entirely 'xml'.


Let me know if that makes sense.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


Index: System.Xml/XmlTextReader.cs
===
--- System.Xml/XmlTextReader.cs	(revision 51479)
+++ System.Xml/XmlTextReader.cs	(working copy)
@@ -2006,7 +2006,7 @@
 	ReadChar ();
 			}
 			if (new string (peekChars, 2, 4) != "xml ") {
-if (new string (peekChars, 2, 3).ToLower (CultureInfo.InvariantCulture) == "xml") {
+if (new string (peekChars, 2, 4).ToLower (CultureInfo.InvariantCulture) == "xml ") {
 	throw NotWFError ("Processing instruction name must not be character sequence 'X' 'M' 'L' with case insensitivity.");
 }
 peekCharsIndex = 0;
Index: System.Xml/ChangeLog
===
--- System.Xml/ChangeLog	(revision 51479)
+++ System.Xml/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+1005-10-07  Joshua Tauberer <[EMAIL PROTECTED]>
+
+	* XmlTextReader.cs: SkipTextDeclaration would not accept processing
+	instructions that began with the string 'xml', e.g. rejecting
+	'xml-stylesheet'.
+
 2005-10-08  Gert Driesen <[EMAIL PROTECTED]>
 
 	* XmlAttribute.cs: InnerText and InnerXml do not override getters in
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] (Nevermind) Asp.net thread abort issue

2005-10-08 Thread Joshua Tauberer
Nevermind my last email looks like it was my fault for catching the 
ThreadAbortException and not either passing it up so ResetAbort() would 
be called in System.Web.HttpApplication or calling ResetAbort() myself. :)


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Asp.net thread abort issue

2005-10-08 Thread Joshua Tauberer

Gonzalo (and anyone else that might have some ideas, but probably Gonzalo),

I'm experiencing something funny on my website.  I think it started 
after upgrading to the latest RPMs (FC4).  It goes something like this:


A request is made for page X.  During the processing of the page (which 
is handled by a custom HttpHandler), HttpResponse.Redirect is called to 
send the user to page Y.  (This is properly calling Thread.Abort, 
issuing a ThreadAbortException, and the request nicely comes to an end.)


The user then requests page Y.  Deep in the processing of this page 
(custom HttpHandler to System.Xml.Xslt which uses extension functions 
which calls back to my code), a ThreadAbortException is mysteriously 
being thrown.  The result is the request ends with no content being sent 
to the user.  The stack trace shows the exception being thrown in the 
middle of one of my methods, which for sure doesn't throw that exception 
and doesn't call Response.Redirect.


I don't know how Thread.Abort works, but my guess is that some flag is 
being set the first time Thread.Abort is called within 
Response.Redirect, and that's leading to Thread.Abort being thrown a 
second time later on.  But I can only imagine this happening if in the 
ASP.NET hosting area of things a worker thread is catching the 
ThreadAbortException, tossing it away, and then handling another request.


I'll keep poking around to see if I can figure this out, but you might 
already know where to look.


TIA.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Revised mod_mono vhost clash patch

2005-09-23 Thread Joshua Tauberer

Gonzalo,

As I posted last Saturday, with virtual hosts and default aliases, each 
vhost's default mod-mono-server would be tied to the same unix socket 
file.  In the attached patch (simplified from last time), the "default" 
name for default XSPs within virtual hosts is changed to the hostname of 
the virtual host, and a separate flag is used to track which XSP is the 
default one.


Additionally, the control panel (and start_xsp and terminate_xsp) is 
revised so that one can restart individual XSPs.


The part from last week about redirecting stdin/out is removed.

Let me know if it's ok to commit.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


Index: ChangeLog
===
--- ChangeLog	(revision 50181)
+++ ChangeLog	(working copy)
@@ -1,3 +1,19 @@
+2005-09-23 Joshua Tauberer <[EMAIL PROTECTED]>
+
+	* src/mod_mono.c:
+	
+	  The default alias for xsp's within vhosts is the name of the
+	  vhost server, so that vhosts with default aliases don't all
+	  use the same Unix socket file name.  A new is_default field
+	  tracks whether an XSP is the server default, rather than using
+	  the "default" alias.
+	  
+	  Aliases are never NULL except when passed to search_for_alias,
+	  start_xsp, and terminate_xsp2.
+	  
+	  The control panel is amended so that individual XSPs
+	  can be restarted.
+
 2005-09-01 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
 	* src/mod_mono.[ch]: one single read for all the headers.
Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 50181)
+++ src/mod_mono.c	(working copy)
@@ -50,6 +50,7 @@
 };
 
 typedef struct xsp_data {
+	char is_default;
 	char *alias;
 	char *filename;
 	char *run_xsp;
@@ -81,15 +82,16 @@
 static int
 search_for_alias (const char *alias, module_cfg *config)
 {
+	// alias may be NULL to search for the default XSP	
 	int i;
 	xsp_data *xsp;
 
 	for (i = 0; i < config->nservers; i++) {
 		xsp = &config->servers [i];
-		if (alias == NULL && !strcmp (xsp->alias, "default"))
+		if (alias == NULL && xsp->is_default)
 			return i;
 
-		if (!strcmp (alias, xsp->alias))
+		if (alias != NULL && !strcmp (alias, xsp->alias))
 			return i;
 	}
 
@@ -113,20 +115,19 @@
 }
 
 static int
-add_xsp_server (apr_pool_t *pool, const char *alias, module_cfg *config, int is_virtual)
+add_xsp_server (apr_pool_t *pool, const char *alias, module_cfg *config, int is_default, int is_virtual)
 {
 	xsp_data *server;
 	xsp_data *servers;
 	int nservers;
 	int i;
-	char is_default;
 
 	i = search_for_alias (alias, config);
 	if (i >= 0)
 		return i;
 
-	is_default = (alias == NULL || !strcmp (alias, "default"));
 	server = apr_pcalloc (pool, sizeof (xsp_data));
+	server->is_default = is_default;
 	server->alias = apr_pstrdup (pool, alias);
 	server->filename = NULL;
 	server->run_xsp = "True";
@@ -172,6 +173,7 @@
 	module_cfg *config;
 	char *ptr;
 	unsigned long offset;
+	int is_default;
 	
 	offset = (unsigned long) cmd->info;
 	DEBUG_PRINT (1, "store_config %lu '%s' '%s'", offset, first, second);
@@ -179,15 +181,18 @@
 
 	if (second == NULL) {
 		alias = "default";
+		if (cmd->server->is_virtual) alias = cmd->server->server_hostname;
 		value = first;
+		is_default = 1;
 	} else {
 		alias = first;
-		value = second; 
+		value = second;
+		is_default = 0;
 	}
 
 	idx = search_for_alias (alias, config);
 	if (idx == -1)
-		idx = add_xsp_server (cmd->pool, alias, config, cmd->server->is_virtual);
+		idx = add_xsp_server (cmd->pool, alias, config, is_default, cmd->server->is_virtual);
 
 	ptr = (char *) &config->servers [idx];
 	ptr += offset;
@@ -737,9 +742,6 @@
 static char *
 get_default_socket_name (apr_pool_t *pool, const char *alias, const char *base)
 {
-	if (alias == NULL || !strcmp (alias, "default"))
-		return (char *) base;
-
 	return apr_pstrcat (pool, base, "_", alias, NULL);
 }
 
@@ -1278,7 +1280,7 @@
 	if (dir_config != NULL && dir_config->alias != NULL)
 		idx = search_for_alias (dir_config->alias, config);
 	else
-		idx = search_for_alias ("default", config);
+		idx = search_for_alias (NULL, config);
 
 	DEBUG_PRINT (2, "idx = %d", idx);
 #ifdef APACHE13
@@ -1327,8 +1329,10 @@
 }
 
 static void
-start_xsp (module_cfg *config, int is_restart)
+start_xsp (module_cfg *config, int is_restart, char *alias)
 {
+	// alias may be NULL to start all XSPs
+	
 	apr_socket_t *sock;
 	apr_status_t rv;
 	char *termstr = "";
@@ -1348,6 +1352,10 @@
 
 		if (xsp->status != FORK_NONE)
 			continue;
+		
+		// If alias isn't null, skip XSPs that don't have that alias.
+		if (alias != NULL && strcmp(xsp->alias, alias))
+			continue;
 
 #i

[Mono-dev] Mod_mono vhost bug, log file

2005-09-19 Thread Joshua Tauberer

Hey,

For a few months I've been using the attached patch to mod_mono which 
does two things:


When there are mod_mono config directives in VirtualHost sections (at 
least in Apache2), the configurations end up stored in per-vhost data 
structures that can't see each other.  As a result, each 'default'-alias 
mod-mono-server (for each vhost) launches its own mod-mono-server, but 
on the same Unix socket.  So the first server launched, configured for 
just one vhost, is used for all of the vhosts.


To prevent these name clashes, I use the ServerName of a vhost as the 
default alias within a vhost.


The second change, which has debatable use, redirects the standard 
in/out of each forked mod-mono-server to a separate log file in /tmp so 
they can be viewed from the mod_mono control panel.  (Since the main 
error_log is root-owned and mod_mono is running at lower privs (e.g. the 
'apache' user), mod_mono didn't have access to read it.)  That makes it 
possible to do Console.Errror.WriteLine debugging without needing root 
access to see the output.  (I have yet to learn how to use the Tracing 
stuff of System.Web.)


What do people think of the second change?

Just as a reminder, you can turn on a mod_mono control panel with:

  SetHandler mono-ctrl
  (access restrictions here!)

And then view it at: http://yourdomain.com/monoctrl/

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


Index: src/mod_mono.c
===
--- src/mod_mono.c	(revision 50181)
+++ src/mod_mono.c	(working copy)
@@ -69,6 +69,7 @@
 	char *env_vars;
 	char status; /* One of the FORK_* in the enum above.
 		  * Don't care if run_xsp is "false" */
+	char is_default;
 	char is_virtual; /* is the server virtual? */
 } xsp_data;
 
@@ -84,12 +85,14 @@
 	int i;
 	xsp_data *xsp;
 
+	if (alias != NULL && !strcmp(alias, "default"))
+		alias = NULL;
+	
 	for (i = 0; i < config->nservers; i++) {
 		xsp = &config->servers [i];
-		if (alias == NULL && !strcmp (xsp->alias, "default"))
+		if (alias != NULL && !strcmp (alias, xsp->alias))
 			return i;
-
-		if (!strcmp (alias, xsp->alias))
+		else if (alias == NULL && xsp->is_default)
 			return i;
 	}
 
@@ -105,7 +108,7 @@
 	sconfig = ap_get_module_config (cmd->server->module_config, &mono_module);
 	config->alias = (char *) alias;
 	if (search_for_alias (alias, sconfig) == -1) {
-		char *err = apr_pstrcat (cmd->pool, "Server alias '", alias, ", not found.", NULL);
+		char *err = apr_pstrcat (cmd->pool, "Server alias '", alias, "', not found.", NULL);
 		return err;
 	}
 
@@ -113,7 +116,7 @@
 }
 
 static int
-add_xsp_server (apr_pool_t *pool, const char *alias, module_cfg *config, int is_virtual)
+add_xsp_server (apr_pool_t *pool, const char *alias, module_cfg *config, const char *vhostName)
 {
 	xsp_data *server;
 	xsp_data *servers;
@@ -121,11 +124,18 @@
 	int i;
 	char is_default;
 
+	is_default = (alias == NULL || !strcmp (alias, "default"));
+	
+	// The default alias within vhosts is the vhost's name, so that
+	// the unix socket file and log file don't clash with those
+	// for other vhosts.
+	if (is_default && vhostName != NULL)
+		alias = vhostName;
+	
 	i = search_for_alias (alias, config);
 	if (i >= 0)
 		return i;
 
-	is_default = (alias == NULL || !strcmp (alias, "default"));
 	server = apr_pcalloc (pool, sizeof (xsp_data));
 	server->alias = apr_pstrdup (pool, alias);
 	server->filename = NULL;
@@ -147,7 +157,8 @@
 	server->debug = "False";
 	server->env_vars = NULL;
 	server->status = FORK_NONE;
-	server->is_virtual = is_virtual;
+	server->is_virtual = (vhostName != NULL);
+	server->is_default = is_default;
 
 	nservers = config->nservers + 1;
 	servers = config->servers;
@@ -187,7 +198,7 @@
 
 	idx = search_for_alias (alias, config);
 	if (idx == -1)
-		idx = add_xsp_server (cmd->pool, alias, config, cmd->server->is_virtual);
+		idx = add_xsp_server (cmd->pool, alias, config, cmd->server->is_virtual ? cmd->server->server_hostname : NULL);
 
 	ptr = (char *) &config->servers [idx];
 	ptr += offset;
@@ -913,6 +924,42 @@
 #endif
 }
 
+static int
+open_server_log (xsp_data *config, int method) {
+	// Opens a log file for this mod-mono-server which
+	// has the same name as the Unix socket file + '.log'.
+	// The log file is truncated each time mod-mono-server
+	// is launched.
+	
+	apr_pool_t *pool;
+	apr_pool_create(&pool, NULL);
+
+	char *fn = config->filename;
+	if (fn == NULL)
+		fn = get_default_socket_name (pool, config->alias, SOCKET_FILE);
+	char *log_file = apr_pcalloc(pool, strlen(fn) + 4 + 1);
+	strcpy(log_file, fn);
+	strcat(log_file, ".log");
+	
+	int

[Mono-devel-list] Mono repository RSS feeds

2005-06-28 Thread Joshua Tauberer
At one point Mono's SVN web view provided RSS feeds which I found really 
useful.  I don't think we have that anywhere anymore, so (because I was 
bored) I set up RSS feeds for the repository.


You can pick out the precise directory to watch by editing the URL, e.g:

http://taubz.for.net/monorss/feed.cgi?mono:/trunk/mcs/class
http://taubz.for.net/monorss/feed.cgi?mono:/trunk/monodoc
http://taubz.for.net/monorss/feed.cgi?monodevelop:/trunk

It updates every few hours or so.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Xml entity handling

2005-06-17 Thread Joshua Tauberer

Atsushi Eno wrote:

And now it should be fixed (at r46122). I removed some nastly
default xmlns* attributes handling.


Much appreciated.  (Tho I haven't tested it.)

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] Xml entity handling

2005-06-16 Thread Joshua Tauberer

Atsushi,

A while back I raised some issues with entity handling, but I think some 
problems remain with entities in namespaces.  It looks like xmlns 
attributes are added to whatever tracks namespaces before their entities 
are resolved.


Attached is entitytest.cs and entitytest.xml.  Entitytest.cs just dumps 
the contents of entitytest.xml, using XmlValidatingReader with 
ValidationType=None.  It shows the xmlns attributes at the root element 
resolved ok, as well as the entity toward the end of the document, but 
the namespace uris of the nodes of the document have their entities 
unresolved.


Surprisingly, the namespace of the document element is OK.

TIA.

--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


using System;
using System.Xml;

public class EntityTest {
public static void Main(string[] args) {
XmlValidatingReader reader = new XmlValidatingReader(new 
XmlTextReader("entitytest.xml"));
reader.ValidationType = ValidationType.None;
//new XmlTextWriter(Console.Out).WriteNode(reader, false);
while (reader.Read()) {
if (reader.NodeType == XmlNodeType.Whitespace) continue;
Console.WriteLine(reader.NodeType + " " + 
reader.NamespaceURI + " " + reader.LocalName);
if (reader.MoveToFirstAttribute()) {
do {
Console.WriteLine("  " + 
reader.NodeType + " " + reader.NamespaceURI + " " + reader.LocalName + " = " + 
reader.Value);
} while (reader.MoveToNextAttribute());
}
}
}
}

http://www.w3.org/1999/02/22-rdf-syntax-ns#"; >
 http://www.w3.org/2000/01/rdf-schema#"; >
 http://www.w3.org/2001/XMLSchema#"; >
 http://www.w3.org/2002/07/owl#"; >
   ]>

http://www.w3.org/2002/07/owl";
  xmlns:rdf ="&rdf;"
  xmlns:rdfs="&rdfs;"
>


  http://www.w3.org/2000/01/rdf-schema"/>
  http://www.w3.org/TR/2004/REC-owl-features-20040210/"; />



  Class
  



___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] patch for bug#57748

2005-06-11 Thread Joshua Tauberer

Rafael Ferreira wrote:

This patch fixes bug#57748 by giving the docbrowser its AssemblyInfo
back and by changing the About dialog to display the extra information.


Hi, Rafael.  You should post monodoc-related patches to mono-docs-list.


I broke up the About dialog into a 4 tab notebook/treeview
(about/authors/plugins/version). 


Not bad.

AboutDialog.cs:

string[] plugins = {"ECMA Documentation","Mono XML Documentation", "Mono Handbook", "Manual 
Pages",  "Compiler Errors","ECMA C# Specification" };


The providers are all compiled into monodoc 'statically', so the user 
has no control over it.  I don't think we need to list them.


AssemblyInfo.cs.in:

[assembly:AssemblyVersion("@DOCBROWSER_VERSION@")]
[assembly:AssemblyDelaySign(true)]


Nice.

configure.in:

+DOCBROWSER_VERSION="1.0"


Miguel needs to chime in with how he would want monodoc to be versioned.

Also, it would be nice to display the monodoc version more prominently, 
instead of just in the list of loaded assemblies.


docbrowser/browser.cs:

-   RootTree.UncompiledHelpSources.Add(args[i+1]);
+   //RootTree.UncompiledHelpSources.Add(args[i+1]);


Please don't disable my features. :)


-class Browser {
+public class Browser {


Why this?


+/*
class About {


You can just delete that class and any Glade stuff it has, if any.


-class Tab : Notebook {
+public class Tab : Notebook {


Again, I don't think this was necessary.

Thanks for working on updating the about dialog.  Can you fix the issues 
I noted, add a ChangeLog, and then repost the patch on mono-docs-list?


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] Contributing Mainsoft System.Web test suite

2005-05-30 Thread Joshua Tauberer

RafaelMizrahi wrote:

  * Microsoft XMLDiffPatch and SGML Reader(XHTML)(need to check license)


I've written something like that XML diff tool (which I hadn't seen 
before) which you might be able to use instead, if you need to switch.


It doesn't detect reordering of XML nodes, but it picks out insertions, 
deletions, and changes fairly well.


http://taubz.for.net/code/diff

If you download the tgz and run the makefile in there, you should get 
XmlDiff.exe (although I don't know if this has ever been tested outside 
of my desktop).  My original hope was to make a C# diff tool, but I 
never got that far.


--
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] -pkg command line option.

2005-04-09 Thread Joshua Tauberer
Miguel de Icaza wrote:
   Mike realized something: if we lack a pkg-config file for say
PACKAGE, we could just reference every library in the
$libdir/mono/PACKAGE directory.
Yes!  I was just talking about the need for pc files and -devel packages 
on the MD list.  With all of the assemblies GACed already, there 
shouldn't be a need for pc files.  Great idea.

--
- Joshua Tauberer
http://taubz.for.net
** Nothing Unreal Exists **
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-devel-list] [OT] Netiquette in the list

2005-03-31 Thread Joshua Tauberer
Sunny wrote:
is there a place I can read about the rules in this list?
I think everyone on the list is pretty accommodating.  No one's gonna 
get upset if you do something that people aren't used to.  :)

I see a lot of messages both top and bottom quoted
And responses inline too.  Your preference.
I see HTML messages etc.
I guess if people have a preference they prefer text only, but I don't 
remember anyone ever having serious issues with HTML.

> And actually what bothers me, is that in  the archives there are some
messages, in which every line ends with " =". What is this?
Has to do with the character encoding, I think.  Not sure what you might 
do about it.

Also, what is the policy about replaying? To the list? Private? I
already posted a question and received both a private answer and
another one in the list. Do we have to keep the list volume low, and
skip some answers to the list?
Replies should generally go to the list so everyone can benefit from 
reading them.

Another thing that comes to mind is that if you send a patch, try to 
make sure your email app sends it as plain text.  On Windows you might 
have to associate the file extension with Notepad or something...  There 
are other general rules for sending patches, like always modify the 
appropriate ChangeLog and follow the Mono coding style (not that I 
always remember these), and send it to the whole list.

--
- Joshua Tauberer
http://taubz.for.net
** Nothing Unreal Exists **
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] Better warning when an assembly can't be loaded

2005-03-22 Thread Joshua Tauberer
Attached is a patch to slightly improve what happens when a referenced 
assembly at run time can't be found anywhere.

The warnings go from ('a' and 'b' are assemblies, 'A' is a class in 'a'):
** (b.exe:21606): WARNING **: Could not find assembly a, references from 
/mnt/part2/dev/b.exe (assemblyref_index=0)
 Major/Minor: 0,0
 Build:   0,0
 Token:
System error: No such file or directory

** (b.exe:21606): WARNING **: Could not load class from .A (token 
0x0101) in /mnt/part2/dev/b.exe
mono: symbol lookup error: mono: undefined symbol: g_assert_warning

... to ...
** (b.exe:22598): WARNING **: The following assembly referenced from 
/mnt/part2/dev/b.exe could not be loaded:
 Assembly:   a(assemblyref_index=0)
 Version:0.0.0.0
 Public Key: (none)
The assembly was not found in the Global Assembly Cache, a path listed 
in the MONO_PATH environment variable, or in the location of the 
executing assembly (/mnt/part2/dev/).

** (b.exe:22598): WARNING **: The class A could not be loaded, used in 
/mnt/part2/dev/b.exe (token 0x0101)

It would be nice to not have Mono die right after that, and instead 
throw a managed exception, but it looks like that involves a lot of work 
to carry the problem back to a point where an exception can be thrown.

Let me know if and when it's ok to commit.
--
- Joshua Tauberer
http://taubz.for.net
** Nothing Unreal Exists **

Index: mono/metadata/class.c
===
--- mono/metadata/class.c	(revision 42100)
+++ mono/metadata/class.c	(working copy)
@@ -2918,7 +2918,10 @@
 		mono_metadata_decode_row (tt, tidx - 1, cols, MONO_TYPEDEF_SIZE);
 		name = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAME]);
 		nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]);
-		return g_strdup_printf ("%s.%s", nspace, name);
+		if (strlen (nspace) == 0)
+			return g_strdup_printf ("%s", name);
+		else
+			return g_strdup_printf ("%s.%s", nspace, name);
 	}
 
 	case MONO_TOKEN_TYPE_REF: {
@@ -2928,7 +2931,10 @@
 		mono_metadata_decode_row (t, (type_token&0xff)-1, cols, MONO_TYPEREF_SIZE);
 		name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
 		nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
-		return g_strdup_printf ("%s.%s", nspace, name);
+		if (strlen (nspace) == 0)
+			return g_strdup_printf ("%s", name);
+		else
+			return g_strdup_printf ("%s.%s", nspace, name);
 	}
 		
 	case MONO_TOKEN_TYPE_SPEC:
@@ -2973,7 +2979,7 @@
 
 	if (!class){
 		char *name = mono_class_name_from_token (image, type_token, context);
-		g_warning ("Could not load class from %s (token 0x%08x) in %s", name, type_token, image->name);
+		g_warning ("The class %s could not be loaded, used in %s (token 0x%08x)", name, image->name, type_token);
 		g_free (name);
 	}
 
Index: mono/metadata/assembly.c
===
--- mono/metadata/assembly.c	(revision 42100)
+++ mono/metadata/assembly.c	(working copy)
@@ -492,7 +492,9 @@
 	if (reference == NULL){
 		char *extra_msg = g_strdup ("");
 
-		if (status == MONO_IMAGE_ERROR_ERRNO) {
+		if (status == MONO_IMAGE_ERROR_ERRNO && errno == ENOENT) {
+			extra_msg = g_strdup_printf ("The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (%s).\n", image->assembly->basedir);
+		} else if (status == MONO_IMAGE_ERROR_ERRNO) {
 			extra_msg = g_strdup_printf ("System error: %s\n", strerror (errno));
 		} else if (status == MONO_IMAGE_MISSING_ASSEMBLYREF) {
 			extra_msg = g_strdup ("Cannot find an assembly referenced from this one.\n");
@@ -500,13 +502,13 @@
 			extra_msg = g_strdup ("The file exists but is not a valid assembly.\n");
 		}
 		
-		g_warning ("Could not find assembly %s, references from %s (assemblyref_index=%d)\n"
-   " Major/Minor: %d,%d\n"
-   " Build:   %d,%d\n"
-   " Token:   %s\n%s",
-   aname.name, image->name, index,
+		g_warning ("The following assembly referenced from %s could not be loaded:\n"
+   " Assembly:   %s(assemblyref_index=%d)\n"
+   " Version:%d.%d.%d.%d\n"
+   " Public Key: %s\n%s",
+   image->name, aname.name, index,
    aname.major, aname.minor, aname.build, aname.revision,
-   aname.public_key_token, extra_msg);
+   strlen(aname.public_key_token) == 0 ? "(none)" : aname.public_key_token, extra_msg);
 		g_free (extra_msg);
 	}
 
Index: mono/metadata/ChangeLog
===
--- mono/metadata/ChangeLog	(re

[Mono-devel-list] Mod-mono-server: Console.WriteLine gives UnauthorizedAccessException

2005-03-12 Thread Joshua Tauberer
Hey, Gonzalo.  Sometimes I'm finding this in my httpd error_log.  It 
might be just after restarting mod-mono-server, I'm not entirely sure. 
But I think it was preventing mod-mono-server from restarting properly.

Unhandled Exception: System.UnauthorizedAccessException: Access to the 
path "[Unknown]" is denied.
in <0x00076> System.IO.FileStream:WriteInternal (byte[],int,int)
in <0x0006b> (wrapper remoting-invoke-with-check) 
System.IO.FileStream:WriteInternal (byte[],int,int)
in <0x00182> System.IO.FileStream:Write (byte[],int,int)
in <0x00063> System.IO.StreamWriter:FlushBytes ()
in <0x0003f> (wrapper remoting-invoke-with-check) 
System.IO.StreamWriter:FlushBytes ()
in <0x00052> System.IO.StreamWriter:Flush ()
in <0xd> System.IO.UnexceptionalStreamWriter:Flush ()
in <0x0005b> System.IO.StreamWriter:Write (string)
in <0x00010> System.IO.UnexceptionalStreamWriter:Write (string)
in <0xe> System.IO.TextWriter:WriteLine (string)
in <0x00035> System.IO.SynchronizedWriter:WriteLine (string)
in <0x00015> System.Console:WriteLine (string)
in <0x008e0> Mono.ASPNET.Server:Main (string[])

It's a strange error.  Looks like maybe this results from Apache 
redirecting standard out to... I don't know, nothingness?  I replaced 
all of the Console.WriteLines with Console.Error.WriteLines in server.cs 
and so far that seems to fix it.  It's also nice seeing some of that 
output in the error_log.

I'm restating mod-mono-server through my control panel in mod_mono that 
I wrote about a while back, so the re-forked process should (?) have the 
same general environment as the original/normal mod_mono-spawned one.

Have you seen this before?
--
- Joshua Tauberer
http://taubz.for.net
** Nothing Unreal Exists **
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list