Thanks for the info and patch. I have a couple questions. The point
of semanticdb-live-p is to determine if the table should be saved. ie,
don't save a database for a directory or table that was deleted.
In this case, it could make one of these assumptions:
If it is a "remote" file (ie file-remote-p), it could:
* Pretend it was "deleted" and save nothing.
* Assume it is live without checking
* detect if the connection is alive (how?) and choose one of the above.
It still needs to check for files if there are no buffers related to the
file, since those are tags that need to be saved, as there are no
reference buffers anymore. :)
Thanks for any info.
On Thu, 2009-06-11 at 17:24 -0500, Dale Sedivec wrote:
> I've got a problem with semanticdb (from CVS HEAD), I think:
> 1. Open a remote file with TRAMP, such as some-host:foo.py.
> 2. Kill the file, and then kill the TRAMP connection buffer. I'm now
> disconnected from some-host.
> 3. Go offline so I can't access some-host anymore.
> 4. Let Emacs sit idle for ~30 seconds.
> At this point Emacs tries to call out to some-host again with
> TRAMP, either failing or getting cancelled by me. Of course it keeps
> trying every time I go idle. debug-on-quit tells me
> semanticdb-save-all-db-idle is the cause of this.
> When semanticdb-save-all-db-idle runs it eventually makes its
> way down to semanticdb-save-db on a semanticdb-project-database-file
> which points at the remote server. The first thing that function does
> (semanticdb-file.el ca. line 214) is to call semanticdb-live-p, which
> in turn calls file-exists-p on the reference-directory. This has the
> effect of TRAMP trying to call back out to some-host.
> I don't have a problem with it calling out to the remote side
> when the buffer is open, but it seems wrong that it should reconnect
> after I've explicitly killed every buffer on that host and then killed
> the TRAMP connection (probably because I'm about to take my laptop on
> the road).
> This same sort of thing happens with my NFS automounts that
> sometimes disappear: I kill all the buffers on the NFS mount point,
> but when I go idle TRAMP will try and touch the directory on NFS.
> This is a longer lock-up, at least on OS X, until I umount -f (or OS X
> prompts me to do so).
> I've got a proposed patch, below, against semanticdb-live-p.
> The patcq makes it so that a semanticdb-project-database is never
> "live" if its "tables" don't refer to any live buffers (per
> buffer-live-p). This patch is against CVS HEAD.
> This patch seems to fix my problem, after a tiny bit of
> testing. However, since I understand almost nothing about Semantic I
> would not be at all surprised to learn that this patch breaks far more
> than it fixes, at least with regard to assumptions made elsewhere
> about the definition of "liveness" WRT semanticdb-project-databases.
> Maybe I'm just trying to do something that shouldn't be done. In any
> case, please consider this a report of a potential bug first, and a
> novice's attempt to diagnose and guess at a solution second.
> Suggestions, feedback, and questions all welcome.
> (Also, apologies if I should have sent this to cedet-semantic
> instead; please correct me if so.)
> diff --git a/semantic/semanticdb-file.el b/semantic/semanticdb-file.el
> --- a/semantic/semanticdb-file.el
> +++ b/semantic/semanticdb-file.el
> @@ -253,8 +253,15 @@ If DB is not specified, then use the current database."
> (defmethod semanticdb-live-p ((obj semanticdb-project-database))
> "Return non-nil if the file associated with OBJ is live.
> -Live databases are objects associated with existing directories."
> +Live databases are objects which have live buffers and are
> +associated with existing directories."
> (and (slot-boundp obj 'reference-directory)
> + (or (not (slot-boundp obj 'tables))
> + (some #'(lambda (table)
> + (let ((buffer (oref obj tables)))
> + (and (not (null buffer))
> + (buffer-live-p buffer))))
> + (oref obj tables)))
> (file-exists-p (oref obj reference-directory))))
> (defmethod semanticdb-live-p ((obj semanticdb-table))
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> Cedet-devel mailing list