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
695 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
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

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…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
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 …

803 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