Why does WebQuerySave sometimes run twice and duplicate my attachment with a filename like ATT*.ext where ext is the original extension?

Posted on 2008-06-16
Last Modified: 2013-11-16
I work for a bank and run Domino 8.01 on our servers.  I am using the the Notes 6.5.6 designer client.  I have a Domino application with a form on which there is an upload control.  I find that sometimes when I upload a large file (>1 meg) the file gets duplicated with a new filename such as ATTnnnnn.ext where ext is nnnnn seems to be a random number and ext is the original extension of the file.  

I have read in other forums that this can occur when a second file is attached to a document that has the same filename as another file already attached.  But this would not be the case in my case.  There were no files attached when I attached a new file called file3.txt, which was 1.5Meg of simple text, but it ended up attached to my document twice, one file with the original filename and one file with a filename like ATT12345.txt.  

Also, WebQuerySave ran twice but I have no idea why or even how I could make this happen if I wanted to make it run twice.  It certainly doesn't call itself or have any methods calls.  I have it write to the log the contents of a field called FileAttachments which is a computed field with the formula @AttachmentNames.  When it ran the first time, it listed only file3.txt but when WebQuerySave ran again it listed both that file and the new file with the filename like ATT12345.txt.  

Another clue is that when I upload smaller files, which I have named file1.txt and file2.txt, which are both < 100K, it never duplicates them and WebQuerySave runs only once.

Does anyone know why this would happen and what I can do about it?  I could delete any files starting with ATT but I am afraid that there may be other scenarios happening and I don't want to delete data my users might need, for instance, in case the original file did get deleted.  Who knows if my users have experienced this but found the file attached as the other filename. Some users would just take this file, rename it and go on without reporting a problem to the help desk.

This is very bad because it is taking up a lot of disk space to have the biggest file attachments duplicated!
Question by:jkurant
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 63

Expert Comment

ID: 21794732
1) I would try to use a newer version of Designer that matches your server version.

2) Check to see if their are any file size limitations, or conversions going on.
 I hope this helps !

Author Comment

ID: 21795162
To try to isolate the problem I have created a very simple form which has just the file upload control and a save and close button.  The files do not get duplicated.  Now I will try adding WebQuerySave to the simple upload form.  No duplication.  I took the same subform I use for the upload on the more complex forms in the database and added it to my simple form, replacing the upload control there, and I don't get the duplications, but what could be different about the complex forms and the simple one?  Could there be a replication conflict type of thing happening?  I just don't know what to look for.


Author Comment

ID: 21795170
Also, it is intermittent.  It never happens for very small files (<100K) and usually happens for files over 1 meg, but not always.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 31

Accepted Solution

qwaletee earned 500 total points
ID: 21807126
It does sound like the entire transaction is being processed twice, in which case it would make sense that WQS would run twice and there would be two attachments. Do you have any redirects going on?

Note that techniclaly, it is POSSIBLE to have two separate WQS events in a submission. In the WebQuerySave event, you can have:
@Command([ToolsRunMacro]; "agent one")
@Command([ToolsRunMacro]; "agent two")

Both will run. Do you have anything like this? Even if not, it is possible there is some corruption there. I would try a test with the WQS event cleared, do a big upload, check what happens, t hen put the @Command([ToolsRunMacro]; "...") back in, try it again.

Author Comment

ID: 21807375
Well, thank you for letting me know I could run two agents by doing this!

@Command([ToolsRunMacro]; "agent one")
@Command([ToolsRunMacro]; "agent two")

Unfortunately, I am not doing this.  What is very strange to me is that I have put something in $$Return that calls code that I can see running in my log.  So, when WebQuerySave runs once, I see WQS followed by the "open" code (I am doing a save, so save and then re-open the document).  When it runs twice, I would expect the WQS code to run, then the open code, then the WebQuerySave to run again, but this is not what I see.  I see the WebQuerySave twice and then the open code.  

It is starting to look to me as though the browser submitted it twice.  Is that possible?  If I had


would that do it?  What if I had a button that did doc.submit and the user "double-clicked" it, making it run twice.  Of course, that is not what I did during my testing, but I'm just grasping at straws at this point.

Author Closing Comment

ID: 31468169
It wasn't a total solution so much as putting me on the right path, but I very much believe that qwaletee should get full credit for this for sending me in the right direction.  I hadn't really believed it was possible that the POST was happening twice, but since qwaletee suggested that possibility, I tested it and found that the code that saves the document when a user attaches a file (using IBM's file upload control), was doing the submit twice in a row, rapidfire, due to "unexpected event firing", if you will.

And all of this was to track down the real problem which is that about a document per week gets corrupted in my large, high volume database, and it seems to have to do with file attachments.  The issue I presented here was just a bump in my road to solving that problem, or so I thought.  Now I bet that fixing this double-submit issue fixes everything!
LVL 46

Expert Comment

by:Sjef Bosman
ID: 21811706
Did you know you are not allowed to use currentdocument.Save() in a WebQuerySave agent?

Now you know, and I suppose that was the real problem.

Author Comment

ID: 21812386
Oh, no.  I certainly did not use .save on the current document in WebQuerySave.
LVL 46

Expert Comment

by:Sjef Bosman
ID: 21812602
I could have sworn though...

So sorry!

PS It is even possible to add more formula code in the WQS event:

@If(...; @Command([ToolsRunMacro]; "agent one"); "");
@Command([ToolsRunMacro]; "agent two")

Lastly, the WQS-code runs every time the  form is refreshed, so even when the final document is not saved in the database but there were intermediate documents used when the form was refreshed, the WQS fires.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating a new theme in discussion8.ntf 6 190
Lotus Domino Server Failure 1 205
VBA Lotus notes 2 211
Permanent Lotus Notes Connection for all users in a Domino Domain 15 112
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question