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
690 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
Comment Utility
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
Comment Utility
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
Comment Utility
Also, it is intermittent.  It never happens for very small files (<100K) and usually happens for files over 1 meg, but not always.
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 500 total points
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

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

Expert Comment

by:Sjef Bosman
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now