2014-10-21

MongoVue GridFS bug

I have been a MongoVUE user for some time and have always been quite happy with it. I had a bug or problem a few years ago (can't remember what exactly) and was quite astonished that their site doesn't feature a "support" section. All you can do is click "contact us" and fill in some crappy e-mail form. Back then, if I recall correctly, it must've done the job because the bug has been fixed (I guess).

WARNING!

Let me start off with a warning: It seems the product is no longer supported. Between the 1.5.3 and 1.6.0 release was more than a year (which is why I first started questioning the 'rate' at which this application is developed/maintained). Since then the update-rate seemed to pick up again but since January 2014 it has, again, been quiet. Now, don't get me wrong; I am not saying that there should be a weekly, monthly, quarterly or whatever update but I do get a very strong feeling that MongoVUE isn't a very 'high priority project' for "Learning Mile" which is, apparently, according to the "About dialog" and included "license.html"-file, the company behind it. Their twitter account has been silent since March 15th 2012, the Facebook page shows no activity since March 22nd 2012 and a lot of pages seem to reference blog.mongovue.com which seems to have disappeared (and archive.org couldn't help me finding out around which time it would've disappeared). And I haven't been able to find any information on "Learning Mile" to date. So except for some (as far as I could find out) unannounced updates they seem to have either disappeared from the face of the earth or gone awfully quiet. Even more troubling are some messages people left on their Facebook page:

Lots of complaints on MongoVUE's Facebook page

I had my licence renewed February 26th 2013 which still seems to work *fingers crossed*. Lucky me. If anyone can confirm or deny MongoVUE / Learning Mile going bust, quitting etc. I would appreciate it very much!
Update: Meanwhile I figured out that someone named "Ishann / Ishan / Ishaan Kumar"* is the creator of MongoVUE but unless I'm going crazy he's done a pretty good job of hiding all information that used to be online about him / MongoVUE. It's hard to find any real references other than some archive.org pages and some abandoned(?) Facebook page.
* His name varies from site-to-site, searchresult-to-searchresult.
Anyhow; the reason I started writing this blogpost has actually little to do with MongoVUE going (possibly) bust. I did, however, encounter a bug in MongoVUE which I would like to share with you hoping that whenever YOU Google for a similar problem you find this blog post.

Wisdom of the Ancients

So I am storing files in Mongo's GridFS. And while I was developing my application I used MongoVUE to make sure entries got added correctly to MongoDB's collections and GridFS. After confirming a file was added correctly (the file size, MD5, content-type etc. matched) I double-clicked the file in MongoVUE. Since files I add do not contain a file extension (e.g. .txt, .jpg etc.) but simply consist of a 'GUID' Windows asked me which application to open the file with since it cannot determine the filetype without file extension. I selected the desired application and the file opened fine. And I went along implementing the next feature. And the next. And then, somehow, somewhere along the line, I tried to open a file (apparently) for the second time and MongoVUE went *boom*:

MongoVUE is unhappy :-(

I must note here that I have translated the parts in red in the above screenshot to English (hence the slight font mismatch); the original (Dutch in my case) message read:

Error in opening file
De tekenreeks kan niet de lengte nul hebben.
Parameternaam: oldValue
Type: System.ArgumentException
Stack:    bij System.String.Replace(String oldValue, String newValue)
   bij MangoUI.MUtil.IO.paBd98nfNMWxPPUAC8U(Object , Object , Object )
   bij MangoUI.MUtil.IO.GetUnique(String path)
   bij MangoUI.ComGridFS.flFiR2q9xA7P2iD9KCR(Object )
   bij MangoUI.ComGridFS.kOpen_Click(Object sender, EventArgs e)

So it took me some time to realize what was happening. MongoVUE "downloads" the file from MongoDB to your %temp% folder using the actual file name (foo.jpg for example). Whenever you try to open the file again, MongoVUE downloads the file again, finds out that there's already a foo.jpg in the temp folder and then tries to generate a new file name (trying not to overwrite existing files) resulting in foo1.jpg. Each time a file is opened from GridFS in MongoVUE it generates a new unique file name (foo2.jpg, foo3.jpg etc. etc). Everything seemed to work fine with files I added manually (like, the aforementioned, foo.jpg); even opening more than once. But files that had been "uploaded" using my application would only open once and a second (or more) attempt would result in above error.

The error is simply explained once you know what's happening: since there is no extension and MongoVUE tries to add a 'counter' before the (non-existing) file extension it fails and throws this error. The only solution (apart from a bug-fix from MongoVUE itself) I have currently found is to either remove the tempfile manually each time you opened a file in MongoVUE or to use a file-extension to prevent MongoVUE's bug to trigger at all. Neither is really desirable so I'd be glad to try out any other suggestions. Or even better; find that there's a new version available next week :-)

Happy debugging!