Solved

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
9
699 Views
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 agent.run 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!
0
Comment
Question by:jkurant
9 Comments
 
LVL 63

Expert Comment

by:SysExpert
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 !
0
 

Author Comment

by:jkurant
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.

0
 

Author Comment

by:jkurant
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.
0
Technology Partners: 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

by:
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.
0
 

Author Comment

by:jkurant
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

doc.submit
doc.submit

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.
0
 

Author Closing Comment

by:jkurant
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!
0
 
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.
0
 

Author Comment

by:jkurant
ID: 21812386
Oh, no.  I certainly did not use .save on the current document in WebQuerySave.
0
 
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

685 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