Graham,

This issue has been resolved by a fix to mod_dav_svn.

On the Subversion Users list, developer Ben Reser writes:

Thanks Philip.  When I made this change I expected that other modules would 
be ok with r->filename being NULL.  I guess that's not the case.

I've fixed the problem on trunk in r1537360.  Change has been nominated for 
1.7.x and 1.8.x backport.

Larry, I've attached a patch which should resolve the problem for you. 
 Thanks for the report.

The provided patch, which I have confirmed fixes the problem for me, is 
attached.

On Wednesday, October 30, 2013 5:35:05 PM UTC-5, Graham Dumpleton wrote:
>
> Are you able to provide a core dump stack trace for where specifically in 
> mod_wsgi the crash is occurring.
>
> For a actual WSGI application, mod_wsgi requires r->filename to have a non 
> NULL value.
>
> I can't on quick glance see where in the auth handlers themselves it is 
> using r->filename and so cause an issue there. I can see a potential issue 
> issue in the code which loads and/or reloads the Python source code for a 
> script file but that is guessing as to the problem. Logging in the event of 
> an error may also be an issue as well.
>
> A stack trace would therefore help me to identify what needs to change.
>
> Graham
>
> On 31/10/2013, at 6:25 AM, [email protected] <javascript:> wrote:
>
> Apologies for following up my own reply, but the discussion of this issue 
> is happening in two forums, the other being the Subversion users mailing 
> list.
>
> Of interest to mog_wsgi is the most recent message from Philip Martin:
>
> Philip Martin <[email protected] <javascript:>> writes:
>
> ... 
>
> It appears to be caused by r1514941 which added the translate_name and 
> map_to_storage hooks to mod_dav_svn.
>
> Subversion's translate_name hook is setting r->filename to NULL and it 
> appears that mod_wsgi does not check for NULL.
>
>
> On Wednesday, October 30, 2013 11:45:31 AM UTC-5, [email protected]:
>>
>> Thanks for responding Graham.  Unfortunately, the Apache segfaults 
>> continue with mod_wsgi 3.4.
>>
>> [Wed Oct 30 16:22:58 2013] [notice] Apache/2.2.22 (Ubuntu) DAV/2 
>> SVN/1.7.13 mod_wsgi/3.4 Python/2.7.3 configured -- resuming normal 
>> operations
>> [Wed Oct 30 16:22:58 2013] [info] Server built: Jul 12 2013 13:37:15
>> [Wed Oct 30 16:22:58 2013] [debug] worker.c(1757): AcceptMutex: sysvsem 
>> (default: sysvsem)
>> [Wed Oct 30 16:22:58 2013] [info] mod_wsgi (pid=25136): Initializing 
>> Python.
>> [Wed Oct 30 16:22:58 2013] [info] mod_wsgi (pid=25135): Initializing 
>> Python.
>> [Wed Oct 30 16:22:58 2013] [info] mod_wsgi (pid=25135): Attach 
>> interpreter ''.
>> [Wed Oct 30 16:22:58 2013] [info] mod_wsgi (pid=25136): Attach 
>> interpreter ''.
>> [Wed Oct 30 16:23:12 2013] [debug] mod_deflate.c(615): [client <elided>] 
>> Zlib: Compressed 481 to 328 : URL /projects/firetracks
>> [Wed Oct 30 16:23:14 2013] [info] [client <elided>] mod_wsgi (pid=25135, 
>> process='', application=''): Loading WSGI script 
>> '/var/lib/wsgi/access.wsgi'.
>> [Wed Oct 30 16:23:14 2013] [info] [client <elided>] mod_wsgi (pid=25136, 
>> process='', application=''): Loading WSGI script 
>> '/var/lib/wsgi/access.wsgi'.
>> [Wed Oct 30 16:23:14 2013] [notice] child pid 25135 exit signal 
>> Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
>> [Wed Oct 30 16:23:14 2013] [notice] child pid 25136 exit signal 
>> Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
>> [Wed Oct 30 16:23:15 2013] [info] mod_wsgi (pid=25194): Initializing 
>> Python.
>> [Wed Oct 30 16:23:15 2013] [info] mod_wsgi (pid=25194): Attach 
>> interpreter ''.
>>
>> What we know is that mod_dav_svn works as expected without mod_wsgi auth 
>> directives (per the original report.)
>> Based on feedback on the Subversion users list, I confirmed that mod_wsgi 
>> 3.3 functions as expected without mod_dav_svn,
>> using the Apache configuration:
>>
>> CoreDumpDirectory /tmp/apache2-gdb-dump
>>
>> LogLevel debug
>>
>> listen 8080
>>
>> <VirtualHost *:8080>
>>
>>     ServerName svn.mydomain.org
>>
>>     DocumentRoot /var/www
>>
>>     <Location /index.html>
>>
>>         WSGIAccessScript /var/lib/wsgi/access.wsgi
>>
>>     </Location>
>>
>> </VirtualHost>
>>
>> <VirtualHost *:80>
>>
>>     ServerName svn.mydomain.org
>>
>>     DocumentRoot /var/www
>>
>>     <Location /index.html>
>>
>>         AuthType Basic
>>
>>         AuthName "WSGIAuth"
>>
>>         AuthBasicProvider wsgi
>>
>>         WSGIAuthUserScript /var/lib/wsgi/access.wsgi
>>
>>         Require valid-user
>>
>>         WSGIAuthGroupScript /var/lib/wsgi/access.wsgi
>>
>>         Require group authorized
>>
>>     </Location>
>>
>> </VirtualHost>
>>
>>
>> (This has been reconfirmed with mod_wsgi 3.4.)   And we know that the 
>> intended configuration
>> works as expected with mod_dav_svn from Subversion 1.7.9 and mod_wsgi 3.3.
>>
>> Is there something more I can do to help clarify this?
>>  
>>
>> On Tuesday, October 29, 2013 7:33:41 PM UTC-5, Graham Dumpleton wrote:
>>>
>>> Upgrade mod_wsgi.
>>>
>>> From memory, the subversion crashes was addressed in mod_wsgi 3.4 by:
>>>
>>> 7. Response Content-Type header could be corrupted when being sent in   
>>>         
>>> multithreaded configuration and embedded mode being used. Problem thus   
>>>        
>>> affected Windows and worker MPM on UNIX.                                 
>>>        
>>>
>>> Graham
>>>
>>> On 29/10/2013, at 11:58 PM, [email protected] wrote:
>>>
>>> *[Cross-posted to [email protected]]*
>>>
>>> An Apache configuration serving Subversion repositories, with mod_wsgi 
>>> 3.3 authentication provider, causes per request segfaults in Apache 2.2.22 
>>> with mod_dav_svn from Subversion 1.7.13.  If mod_wsgi auth directives are 
>>> removed from the Apache configuration, then repositories are served 
>>> properly.
>>>
>>> The identical configuration with Subversion 1.7.9 (from 
>>> https://launchpad.net/~svn/+archive/ppa) and the stock Ubuntu 12.04 
>>> Subversion 1.6.17 works as expected with mod_wsgi auth directives in place.
>>>
>>> Environment:
>>> Ubuntu 12.04.3 LTS (GNU/Linux 3.2.0-55-virtual x86_64)
>>> Apache/2.2.22 (Ubuntu) DAV/2 SVN/1.7.13 mod_wsgi/3.3 Python/2.7.3
>>> Subversion 1.7.13 (http://subversion.apache.org/packages.html Ubuntu 
>>> Linux: WANdisco)
>>>
>>> Loaded Modules:
>>> core_module (static)
>>> log_config_module (static)
>>> logio_module (static)
>>> mpm_worker_module (static)
>>> http_module (static)
>>> so_module (static)
>>> alias_module (shared)
>>> auth_basic_module (shared)
>>> authn_file_module (shared)
>>> authz_default_module (shared)
>>> authz_groupfile_module (shared)
>>> authz_host_module (shared)
>>> authz_user_module (shared)
>>> autoindex_module (shared)
>>> cgid_module (shared)
>>> dav_module (shared)
>>> dav_svn_module (shared)
>>> authz_svn_module (shared)
>>> deflate_module (shared)
>>> dir_module (shared)
>>> env_module (shared)
>>> mime_module (shared)
>>> negotiation_module (shared)
>>> reqtimeout_module (shared)
>>> setenvif_module (shared)
>>> status_module (shared)
>>> wsgi_module (shared)
>>>
>>> httpd.conf:
>>>
>>> CoreDumpDirectory /tmp/apache2-gdb-dump
>>> LogLevel debug
>>>
>>> listen 8080
>>>
>>> <VirtualHost *:8080>
>>>    ServerName svn.mydomain.org
>>>    <Location /projects>
>>>        DAV svn
>>>        SVNParentPath /var/lib/svn
>>>        SVNListParentPath Off
>>>        WSGIAccessScript /var/lib/wsgi/access.wsgi
>>>    </Location>
>>> </VirtualHost>
>>>
>>> <VirtualHost *:80>
>>>    ServerName svn.mydomain.org
>>>    <Location /projects>
>>>        DAV svn
>>>        SVNParentPath /var/lib//svn
>>>        SVNListParentPath Off
>>>        AuthType Basic
>>>        AuthName "WSGIAuth"
>>>        AuthBasicProvider wsgi
>>>        WSGIAuthUserScript /var/lib/wsgi/access.wsgi
>>>        Require valid-user
>>>        WSGIAuthGroupScript /var/lib/wsgi/access.wsgi
>>>        Require group authorized
>>>    </Location>
>>> </VirtualHost>
>>>
>>> access.wsgi:
>>>
>>> import logging
>>> logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s',
>>>                    level=logging.DEBUG)
>>> LOG = logging.getLogger(__name__)
>>>
>>> def allow_access(*args, **kwargs):
>>>  LOG.debug("mod_wsgi allow_access called.")
>>>  return True
>>>
>>> def check_password(*args, **kwargs):
>>>  LOG.debug("mod_wsgi check_password called.")
>>>  return True
>>>
>>> def groups_for_user(*args, **kwargs):
>>>  LOG.debug("mod_wsgi groups_for_user called.")
>>>  return [“authorized”]
>>>
>>> Apache error log:
>>>
>>> [Tue Oct 29 11:12:45 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+.
>>> [Tue Oct 29 11:12:45 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
>>> [Tue Oct 29 11:12:45 2013] [notice] Apache/2.2.22 (Ubuntu) DAV/2 
>>> SVN/1.7.13 mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal 
>>> operations
>>> [Tue Oct 29 11:12:45 2013] [info] Server built: Jul 12 2013 13:37:15
>>> [Tue Oct 29 11:12:45 2013] [debug] worker.c(1757): AcceptMutex: sysvsem 
>>> (default: sysvsem)
>>> [Tue Oct 29 11:12:45 2013] [info] mod_wsgi (pid=11326): Initializing 
>>> Python.
>>> [Tue Oct 29 11:12:45 2013] [info] mod_wsgi (pid=11325): Initializing 
>>> Python.
>>> [Tue Oct 29 11:12:45 2013] [info] mod_wsgi (pid=11326): Attach 
>>> interpreter ''.
>>> [Tue Oct 29 11:12:45 2013] [info] mod_wsgi (pid=11325): Attach 
>>> interpreter ''.
>>> [Tue Oct 29 11:12:55 2013] [debug] mod_deflate.c(615): [client 
>>> 129.59.105.145] Zlib: Compressed 481 to 328 : URL /projects/somerepo
>>> [Tue Oct 29 11:12:59 2013] [info] [client <elided>] mod_wsgi (pid=11326, 
>>> process='', application=''): Loading WSGI script 
>>> '/var/lib/wsgi/access.wsgi'.
>>> [Tue Oct 29 11:12:59 2013] [info] [client <elided>] mod_wsgi (pid=11325, 
>>> process='', application=''): Loading WSGI script 
>>> '/var/lib/wsgi/access.wsgi'.
>>> [Tue Oct 29 11:13:00 2013] [notice] child pid 11325 exit signal 
>>> Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
>>> [Tue Oct 29 11:13:00 2013] [notice] child pid 11326 exit signal 
>>> Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
>>> [Tue Oct 29 11:13:01 2013] [info] mod_wsgi (pid=11384): Initializing 
>>> Python.
>>> [Tue Oct 29 11:13:01 2013] [info] mod_wsgi (pid=11384): Attach 
>>> interpreter ''.
>>> [Tue Oct 29 11:13:19 2013] [info] mod_wsgi (pid=11412): Initializing 
>>> Python.
>>> [Tue Oct 29 11:13:19 2013] [info] mod_wsgi (pid=11412): Attach 
>>> interpreter ''.
>>> [Tue Oct 29 11:13:21 2013] [info] [client <elided>] mod_wsgi (pid=11384, 
>>> process='', application=''): Loading WSGI script 
>>> '/var/lib/wsgi/access.wsgi'.
>>> [Tue Oct 29 11:13:21 2013] [info] [client <elided>] mod_wsgi (pid=11412, 
>>> process='', application=''): Loading WSGI script 
>>> '/var/lib/wsgi/access.wsgi'.
>>> [Tue Oct 29 11:13:22 2013] [notice] child pid 11384 exit signal 
>>> Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
>>> [Tue Oct 29 11:13:22 2013] [notice] child pid 11412 exit signal 
>>> Segmentation fault (11), possible coredump in /tmp/apache2-gdb-dump
>>> [Tue Oct 29 11:13:23 2013] [info] mod_wsgi (pid=11442): Initializing 
>>> Python.
>>> [Tue Oct 29 11:13:23 2013] [info] mod_wsgi (pid=11442): Attach 
>>> interpreter ''.
>>>
>>> No core dumps were generated.
>>>
>>> Apache access log:
>>>
>>> svn.mydomain.org:80 <elided> - - [29/Oct/2013:11:12:55 +0000] "OPTIONS 
>>> /projects/somerepo HTTP/1.1" 401 665 "-" "SVN/1.7.13 neon/0.29.6"
>>> svn.mydomain.org:80 <elided> - - [29/Oct/2013:11:13:18 +0000] "OPTIONS 
>>> /projects/somerepo HTTP/1.1" 401 720 "-" "SVN/1.7.13 serf/1.2.1”
>>>
>>> Subversion client commands:
>>> $ svn co --username somebody http://svn.mydomain.org/projects/somerepo
>>> Authentication realm: 
>>> <http://svn.mydomain.org:80<http://svn.mydomain.org/>> 
>>> WSGIAuth
>>> Password for 'somebody':
>>> svn: E175002: Unable to connect to a repository at URL 'http:/
>>> svn.mydomain.org/projects/somerepo'
>>> svn: E175002: OPTIONS of 'http://svn.mydomain.org/projects/somerepo': Could 
>>> not read status line: connection was closed by server (
>>> http://svn.mydomain.org)
>>> $ svn co --config-option servers:global:http-library=serf --username 
>>> somebody 
>>> http:///svn.mydomain.org/projects/somerepo<http://svn.mydomain.org/projects/somerepo>
>>> Authentication realm: 
>>> <http://svn.mydomain.org:80<http://svn.mydomain.org/>> 
>>> WSGIAuth
>>> Password for 'somebody':
>>> svn: E120108: Unable to connect to a repository at URL '
>>> http:///svn.mydomain.org/projects/somerepo'<http://svn.mydomain.org/projects/somerepo'>
>>> svn: E120108: Error running context: APR does not understand this error 
>>> code
>>>
>>> I appreciate your help in identifying the cause of Apache segfaults with 
>>> mod_dav_svn from Subversion 1.7.13.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "modwsgi" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/modwsgi.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/groups/opt_out.
Index: subversion/mod_dav_svn/mod_dav_svn.c
===================================================================
--- subversion/mod_dav_svn/mod_dav_svn.c	(revision 1537360)
+++ subversion/mod_dav_svn/mod_dav_svn.c	(working copy)
@@ -926,11 +926,15 @@ static int dav_svn__handler(request_rec *r)
 
 #define NO_MAP_TO_STORAGE_NOTE "dav_svn-no-map-to-storage"
 
-/* Prevent filename on the request from being set since we aren't serving a
- * file off the disk.  This means that <Directory> blocks will not match and
- * that * %f in logging formats will show as "-". */
+/* Fill the filename on the request with a bogus path since we aren't serving
+ * a file off the disk.  This means that <Directory> blocks will not match and
+ * that %f in logging formats will show as "svn:/path/to/repo/path/in/repo". */
 static int dav_svn__translate_name(request_rec *r)
 {
+  const char *fs_path, *repos_basename, *repos_path;
+  const char *ignore_cleaned_uri, *ignore_relative_path;
+  int ignore_had_slash;
+  dav_error *err;
   dir_conf_t *conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
 
   /* module is not configured, bail out early */
@@ -937,19 +941,47 @@ static int dav_svn__translate_name(request_rec *r)
   if (!conf->fs_path && !conf->fs_parent_path)
     return DECLINED;
 
-  /* Be paranoid and set it to NULL just in case some other module set it
-   * before we got called. */ 
-  r->filename = NULL;
+  /* Retrieve path to repo and within repo for the request */
+  if ((err = dav_svn_split_uri(r, r->uri, conf->root_dir, &ignore_cleaned_uri,
+                               &ignore_had_slash, &repos_basename,
+                               &ignore_relative_path, &repos_path)))
+    {
+      dav_svn__log_err(r, err, APLOG_ERR);
+      return HTTP_INTERNAL_SERVER_ERROR;
+    }
+  if (conf->fs_parent_path)
+    {
+      fs_path = svn_dirent_join(conf->fs_parent_path, repos_basename,
+                                r->pool);
+    }
+  else
+    {
+      fs_path = conf->fs_path;
+    }
 
-  /* Leave a note to ourselves so that we know not to decline in the 
+  /* Before we can combine repos_path with fs_path need to make sure it isn't
+   * NULL and to skip the leading '/' to "convert" it to a relpath appropriate
+   * for joining. */
+  if (!repos_path)
+    repos_path = "";
+  else if ('/' == *repos_path)
+    repos_path++;
+
+  /* Combine 'svn:', fs_path and repos_path to produce the bogus path we're
+   * placing in r->filename. */
+  r->filename = apr_pstrcat(r->pool, "svn:",
+                            svn_dirent_join(fs_path, repos_path, r->pool),
+                            NULL);
+
+  /* Leave a note to ourselves so that we know not to decline in the
    * map_to_storage hook. */
-  apr_table_setn(r->notes, NO_MAP_TO_STORAGE_NOTE, (const char*)1); 
+  apr_table_setn(r->notes, NO_MAP_TO_STORAGE_NOTE, (const char*)1);
   return OK;
 }
 
 /* Prevent core_map_to_storage from running if we prevented the r->filename
  * from being set since core_map_to_storage doesn't like r->filename being
- * NULL. */
+ * bogus. */
 static int dav_svn__map_to_storage(request_rec *r)
 {
   /* Check a note we left in translate_name since map_to_storage doesn't

Reply via email to