Hi Janko,
I discovered strange behavior with application I'm writing now. I'm using similar technique as in ToDo example to show up dialogs and so on. Let me say, I have: (e addNilLinkText: 'Categories') onClickPopup: (ENCategoriesListWidget new). which creates new ENCategoriesListWidget instance and then show it up. After clicking on Close button in that dialog, it disappear as expected. This work well. But the created instance of ENCategoriesListWidget keeps allocated somewhere in memory so it takes some space. And when you work in application, memory keeps filling with those instances and after 2 days, my application had eaten all reserved memory on server and crashed down. What could be wrong? Same problem is with ToDo example (try create some tasks and discover created instances: ToDoTaskWidget instanceCount it keeps to increase). I'm planning to add instance variable to WebSession, which will hold ENCategoriesListWidget and use it in onClickPopup: instead of creating new instance every time. Do you think, it will help? I'm using Pharo 1.3. Martin _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Hello list,
I have tried to overpass the problem described in my last post. I have created an instance variable, which holds the instance of my widget. It works and prevents from increasing the number of instances of this widget, but another problem occurs here. I have following code: (e addNilLinkText: 'Add') onClickDo: [self expenseWidget isNew: true; onAnswerDo: [:newExpense | self observee addExpense: newExpense. anElement update]]; onClickPopup: self expenseWidget. which works, but every time a webpage is refreshed in browser, onAnswerDo: block is added to the widget again, so after for example 5 refreshes, after I click Save button on widget, it fires that block 5 times, so I have 5 identical records in database. I think, it's because of #addActionBlock: method of WebEventHandler, but I'm not sure, if I can safely change it to hold only the last block (probably it will break some other things in Aida, I'm not expert here ;)). Anyone with some suggestion please? Cheers Martin 27. 7. 2012 v 17:06, Martin Polák <[hidden email]>: > Hi Janko, > > I discovered strange behavior with application I'm writing now. I'm using similar technique as in ToDo example to show up dialogs and so on. Let me say, I have: > > (e addNilLinkText: 'Categories') onClickPopup: (ENCategoriesListWidget new). > > which creates new ENCategoriesListWidget instance and then show it up. After clicking on Close button in that dialog, it disappear as expected. This work well. But the created instance of ENCategoriesListWidget keeps allocated somewhere in memory so it takes some space. And when you work in application, memory keeps filling with those instances and after 2 days, my application had eaten all reserved memory on server and crashed down. What could be wrong? Same problem is with ToDo example (try create some tasks and discover created instances: ToDoTaskWidget instanceCount it keeps to increase). I'm planning to add instance variable to WebSession, which will hold ENCategoriesListWidget and use it in onClickPopup: instead of creating new instance every time. Do you think, it will help? I'm using Pharo 1.3. > > Martin > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Hi Martin,
This is my first guess: try to init widget event handlers at the start of widget build method: aWidget>>#build self initEventHandlers .... But maybe even better would be to put #initEventHandlers in #clear method, I suppose. #Clear is then called from Ajax called #rebuild, but you can call it manually as well. Would you experiment a bit with that idea? Best regards Janko Dne 31. 07. 2012 13:52, piše Martin Polák: > Hello list, > > I have tried to overpass the problem described in my last post. I have created an instance variable, which holds the instance of my widget. It works and prevents from increasing the number of instances of this widget, but another problem occurs here. I have following code: > > (e addNilLinkText: 'Add') onClickDo: [self expenseWidget isNew: true; onAnswerDo: [:newExpense | self observee addExpense: newExpense. anElement update]]; onClickPopup: self expenseWidget. > > which works, but every time a webpage is refreshed in browser, onAnswerDo: block is added to the widget again, so after for example 5 refreshes, after I click Save button on widget, it fires that block 5 times, so I have 5 identical records in database. I think, it's because of #addActionBlock: method of WebEventHandler, but I'm not sure, if I can safely change it to hold only the last block (probably it will break some other things in Aida, I'm not expert here ;)). Anyone with some suggestion please? > > Cheers Martin > > > 27. 7. 2012 v 17:06, Martin Polák <[hidden email]>: > >> Hi Janko, >> >> I discovered strange behavior with application I'm writing now. I'm using similar technique as in ToDo example to show up dialogs and so on. Let me say, I have: >> >> (e addNilLinkText: 'Categories') onClickPopup: (ENCategoriesListWidget new). >> >> which creates new ENCategoriesListWidget instance and then show it up. After clicking on Close button in that dialog, it disappear as expected. This work well. But the created instance of ENCategoriesListWidget keeps allocated somewhere in memory so it takes some space. And when you work in application, memory keeps filling with those instances and after 2 days, my application had eaten all reserved memory on server and crashed down. What could be wrong? Same problem is with ToDo example (try create some tasks and discover created instances: ToDoTaskWidget instanceCount it keeps to increase). I'm planning to add instance variable to WebSession, which will hold ENCategoriesListWidget and use it in onClickPopup: instead of creating new instance every time. Do you think, it will help? I'm using Pharo 1.3. >> >> Martin >> _______________________________________________ >> Aida mailing list >> [hidden email] >> http://lists.aidaweb.si/mailman/listinfo/aida > > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Martin Polák
Hi Martin,
Aida widgets (as also most of other elements) are not garbage collected immediately after usage because you don't know if a webpage with such element is still open or not. Ok, popup widgets are closed explicitly, so we know, but this is a special case. And we don't have a session timeout in Aida to get rid of them soon. But we have a nightly cleanup procedure which essentially call a: AIDASite default releaseApplicationState This method clears all App instances and its elements including widgets. If you know that some App instance is not needed anymore, you can remove manually: anApp removeYourself But in any case, there is something strange with your popup widget to eat all memory in two days, is that widgets store a lot of local data everytime it is created? Best regards Janko Dne 27. 07. 2012 17:06, piše Martin Polák: > Hi Janko, > > I discovered strange behavior with application I'm writing now. I'm using similar technique as in ToDo example to show up dialogs and so on. Let me say, I have: > > (e addNilLinkText: 'Categories') onClickPopup: (ENCategoriesListWidget new). > > which creates new ENCategoriesListWidget instance and then show it up. After clicking on Close button in that dialog, it disappear as expected. This work well. But the created instance of ENCategoriesListWidget keeps allocated somewhere in memory so it takes some space. And when you work in application, memory keeps filling with those instances and after 2 days, my application had eaten all reserved memory on server and crashed down. What could be wrong? Same problem is with ToDo example (try create some tasks and discover created instances: ToDoTaskWidget instanceCount it keeps to increase). I'm planning to add instance variable to WebSession, which will hold ENCategoriesListWidget and use it in onClickPopup: instead of creating new instance every time. Do you think, it will help? I'm using Pharo 1.3. > > Martin > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Janko Mivšek
Hi Janko,
thanks for your reply, it helped :). But I must place #initEventHandlers in onPopupDo: block, because in #build method it clears the last block (which is needed) too. So my code looks like: (e addNilLinkText: 'Add') onClickDo: [self expenseWidget isNew: true; initEventHandlers; onAnswerDo: [:newExpense | self observee addExpense: newExpense. anElement update]]; everything looks now OK. Martin 31. 7. 2012 v 14:12, Janko Mivšek <[hidden email]>: > Hi Martin, > > This is my first guess: try to init widget event handlers at the start > of widget build method: > > aWidget>>#build > self initEventHandlers > .... > > But maybe even better would be to put #initEventHandlers in #clear > method, I suppose. #Clear is then called from Ajax called #rebuild, but > you can call it manually as well. Would you experiment a bit with that idea? > > Best regards > Janko > > _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Nice to hear that. In any case this mounting of onAnswerDo: calls needs
to be rethought and find a way how to avoid it. Have a nice day Janko Dne 31. 07. 2012 16:36, piše Martin Polák: > Hi Janko, > > thanks for your reply, it helped :). But I must place #initEventHandlers in onPopupDo: block, because in #build method it clears the last block (which is needed) too. So my code looks like: > > (e addNilLinkText: 'Add') onClickDo: [self expenseWidget isNew: true; initEventHandlers; onAnswerDo: [:newExpense | self observee addExpense: newExpense. anElement update]]; > > everything looks now OK. > > Martin > > > 31. 7. 2012 v 14:12, Janko Mivšek <[hidden email]>: > >> Hi Martin, >> >> This is my first guess: try to init widget event handlers at the start >> of widget build method: >> >> aWidget>>#build >> self initEventHandlers >> .... >> >> But maybe even better would be to put #initEventHandlers in #clear >> method, I suppose. #Clear is then called from Ajax called #rebuild, but >> you can call it manually as well. Would you experiment a bit with that idea? >> >> Best regards >> Janko >> >> > > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Janko Mivšek
Main problem on my server is now really limited memory resources, so I have approx. 70 MB free ram for running Aida image, so memory got filled really fast. But your advice with AIDASite default releaseApplicationState helped and memory is free now. But it doesn't start automatically, so is there some magic to start it automatically (let's say every 12 hrs)?
Thanks Martin 31. 7. 2012 v 14:22, Janko Mivšek <[hidden email]>: > Hi Martin, > > Aida widgets (as also most of other elements) are not garbage collected > immediately after usage because you don't know if a webpage with such > element is still open or not. Ok, popup widgets are closed explicitly, > so we know, but this is a special case. And we don't have a session > timeout in Aida to get rid of them soon. But we have a nightly cleanup > procedure which essentially call a: > > AIDASite default releaseApplicationState > > This method clears all App instances and its elements including widgets. > > If you know that some App instance is not needed anymore, you can remove > manually: > > anApp removeYourself > > But in any case, there is something strange with your popup widget to > eat all memory in two days, is that widgets store a lot of local data > everytime it is created? > > Best regards > Janko > _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Am 31.07.2012 16:49, schrieb Martin Polák:
> Main problem on my server is now really limited memory resources, so I have approx. 70 MB free ram for running Aida image, so memory got filled really fast. But your advice with AIDASite default releaseApplicationState helped and memory is free now. But it doesn't start automatically, so is there some magic to start it automatically (let's say every 12 hrs)? > > Thanks > Martin > Hi Martin, when I test my app with Selenium from 5 browsers at the same time I quickly have 300000 subInstances of WebElement and 500MB Ram filled up. And guess what, responses get slow :-)) To keep a grip on memory I do what you find below. Copy it into a Workspace to get it syntax highlighted. This is still very experimental and some may be unnecessary. But if I run it with the selenium tests memory consumption stops at 120 MB and keeps responses much faster. Because my tests always create a new model and a new app for it, this expires the sessions after 15 minutes. Please be careful when trying!! Cheers, Herbert [10000 timesRepeat: [ Smalltalk garbageCollect. "some Diagnostics" Transcript cr; show: Process allInstances size asString; show: ' '; show: Semaphore allInstances size asString; show: ' '; show: HTTPConnection allInstances size asString. (Delay forSeconds: 10) wait. "Connections piled up" HTTPConnection allInstances do: [:each| each isOpen ifFalse: [each server notNil ifTrue: [each server removeConnection: each]. each loop: nil; server: nil]]. SwazooTask allInstances do: [:each| each connection ifNotNil: [each connection stream ifNil: [each connection: nil; request: nil; response: nil]]]. (Delay forSeconds: 10) wait. "This is where I release my application state. Application state is small but only then the WebElement subinstances go away." EllingWebTabsApp allInstances do: [:each| each session ifNotNil: [each session isActive ifFalse: [each actionLogoutLogoff]]]. SwazooStream allInstances do: [:each| each socket isActive ifFalse: [each close]]. "Dunno why this helps" Process allInstances do: [:each| (each isTerminated and: [each suspendedContext isNil not]) ifTrue: [each suspendedContext receiver: nil. each suspendedContext: nil]]. "??????" ] ] fork This is how I release my application state: actionLogoutLogoff self site urlResolver removeObject: self observee. self site urlResolver removeObject: rebDownloader. rebDownloader content: nil. rebDownloader := nil. uploadedStream := nil. self redirectTo: 'http://www.heise.de'. "umbiegen auf Startseite" "Didn't yet try to do this at once, so I forked it for later" [(Delay forSeconds: 10) wait. WebSessionManager default removeSession: self session. (self session) initialize; initOther. self observee releaseState. "Maybe unnecessary" self observee: nil. self session: nil; initContexts; initOther] fork _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Hello Herbert,
thank you very much for your post. It looks very useful and I'll try to use some of yours code. Martin >> > Hi Martin, > > when I test my app with Selenium from 5 browsers at the same time I quickly have 300000 subInstances of WebElement and 500MB Ram filled up. And guess what, responses get slow :-)) > > To keep a grip on memory I do what you find below. Copy it into a Workspace to get it syntax highlighted. > This is still very experimental and some may be unnecessary. But if I run it with the selenium tests memory consumption stops at 120 MB and keeps responses much faster. Because my tests always create a new model and a new app for it, this expires the sessions after 15 minutes. > > Please be careful when trying!! > > Cheers, > > Herbert > > [10000 timesRepeat: [ > Smalltalk garbageCollect. > "some Diagnostics" > Transcript cr; show: Process allInstances size asString; show: ' '; show: Semaphore allInstances size asString; show: ' '; show: HTTPConnection allInstances size asString. > (Delay forSeconds: 10) wait. > "Connections piled up" > HTTPConnection allInstances do: [:each| each isOpen ifFalse: [each server notNil ifTrue: [each server removeConnection: each]. each loop: nil; server: nil]]. > SwazooTask allInstances do: [:each| each connection ifNotNil: [each connection stream ifNil: [each connection: nil; request: nil; response: nil]]]. > (Delay forSeconds: 10) wait. > "This is where I release my application state. Application state is small but only then the WebElement subinstances go away." > EllingWebTabsApp allInstances do: [:each| each session ifNotNil: [each session isActive ifFalse: [each actionLogoutLogoff]]]. > SwazooStream allInstances do: [:each| each socket isActive ifFalse: [each close]]. > "Dunno why this helps" > Process allInstances do: [:each| (each isTerminated and: [each suspendedContext isNil not]) ifTrue: [each suspendedContext receiver: nil. each suspendedContext: nil]]. "??????" > ] > ] fork > > > This is how I release my application state: > actionLogoutLogoff > self site urlResolver removeObject: self observee. > self site urlResolver removeObject: rebDownloader. > rebDownloader content: nil. > rebDownloader := nil. > uploadedStream := nil. > self redirectTo: 'http://www.heise.de'. "umbiegen auf Startseite" > "Didn't yet try to do this at once, so I forked it for later" > [(Delay forSeconds: 10) wait. > WebSessionManager default removeSession: self session. > (self session) initialize; initOther. > self observee releaseState. "Maybe unnecessary" > self observee: nil. > self session: nil; initContexts; initOther] fork > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Martin Polák
There is a nightly cleanup in AIDASite>>nightlyCleanup, which triggers
every day at 4 in the morning. It is initialize by putting in a scheduler with AIDASite>>initNightlyCleanup. Check if you have it in scheduler by inspecting AIDASite default scheduler. If not, reinit it: AIDASite default initNightlyCleanup Nightly cleanup looks like: AIDASite>>nighlyCleanup HTTPConnection allInstances do: [:each | each close]. "to GC all streams and buffers" self sessionManager removeGuestSessions. self sessionManager releaseApplicationState. self statistics removeReferersJustOneHit. Same goes with a hourly snapshot, which must be active, did you switch it off? Because Aida 6.4 removes nonactive guest sessions every hour (AIDASite class>>imageSnapshot) Reinit into scheduler that too: AIDASite default initHourlySnapshot With this I can manage my production images in healthy state for months. They are breathing in memory, but not too far to become a problem. Even DOS attacks are handled gracefully with hourly guest session cleanup. There were just few occasions that someone managed to crash those images with DOS attack in 8 years I serve Aida sites this way :) Best regards Janko Dne 31. 07. 2012 16:49, piše Martin Polák: > Main problem on my server is now really limited memory resources, so I have approx. 70 MB free ram for running Aida image, so memory got filled really fast. But your advice with AIDASite default releaseApplicationState helped and memory is free now. But it doesn't start automatically, so is there some magic to start it automatically (let's say every 12 hrs)? > > Thanks > Martin > > > 31. 7. 2012 v 14:22, Janko Mivšek <[hidden email]>: > >> Hi Martin, >> >> Aida widgets (as also most of other elements) are not garbage collected >> immediately after usage because you don't know if a webpage with such >> element is still open or not. Ok, popup widgets are closed explicitly, >> so we know, but this is a special case. And we don't have a session >> timeout in Aida to get rid of them soon. But we have a nightly cleanup >> procedure which essentially call a: >> >> AIDASite default releaseApplicationState >> >> This method clears all App instances and its elements including widgets. >> >> If you know that some App instance is not needed anymore, you can remove >> manually: >> >> anApp removeYourself >> >> But in any case, there is something strange with your popup widget to >> eat all memory in two days, is that widgets store a lot of local data >> everytime it is created? >> >> Best regards >> Janko >> > > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Hi Janko,
JM> AIDASite>>>nighlyCleanup JM> AIDASite default initHourlySnapshot I've taken some inspiration from these two but I think there is a Squeak specific problem with processes too. JM> With this I can manage my production images in healthy state for months. JM> They are breathing in memory, but not too far to become a problem. Can you give some numbers on memory? Also WebElement allSubinstances size before cleanup of a really busy image? Thanks, Herbert mailto:[hidden email] _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Hi list,
it's me again :). After solved my previous problem with memory and saving (hourly snapshot and nightly cleans are working well for me now :)), I found another problem probably related with nightly cleans. Imagine user had worked with application at evening and after that suspended computer without closing browser and resume work at morning (in meantime Aida did AIDASite>>>nighlyCleanup which discarded user's session). So user click on some AJAX link and that fires debugger (session and so on cannot be found). This is not problem on development image, but in my deploy image it leads to Pharo immediately quit (because GUI is suspended as I'm using -vm-display-null on server). Is there some more "inteligent" handling of this I'm not aware of? Thanks Martin _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Hi guys,
FYI: new 6.5 interim feature is also that Ajax functionality survives nightly cleanups. By simply reloading all open pages just few minutes after 4 in the morning. A bit background: nightly cleanup is kind of a session 'timeout', just that sessions in Aida stay and only so called application state is cleaned out. Instances of Apps, that's it. Ok, there is more, only once logged-in sessions stay, while anonymous non-active sessions are 'timed out' in an hour and removed. There is namely also a hourly cleanup to remove such session (including application) state from occasional visitors, from search engine robots and similar. What else is new in 6.5 interim you can see in release notes (for 6.6. already): http://www.aidaweb.si/release-notes-6.6 Best regards Janko Dne 05. 08. 2012 20:11, piše Martin Polák: > Hi list, > > it's me again :). After solved my previous problem with memory and saving (hourly snapshot and nightly cleans are working well for me now :)), I found another problem probably related with nightly cleans. Imagine user had worked with application at evening and after that suspended computer without closing browser and resume work at morning (in meantime Aida did AIDASite>>>nighlyCleanup which discarded user's session). So user click on some AJAX link and that fires debugger (session and so on cannot be found). This is not problem on development image, but in my deploy image it leads to Pharo immediately quit (because GUI is suspended as I'm using -vm-display-null on server). Is there some more "inteligent" handling of this I'm not aware of? > > Thanks > Martin -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Free forum by Nabble | Edit this page |