9 Replies Latest reply on May 28, 2014 2:59 PM by MartinKlier

    Unshared Worksheet: Not cleaning up after tab close / disconnect

    MartinKlier

      Hi SQLdev community,

       

      I just did a little testing with 4.0.2 1521 - especially w/ unshared worksheets. As it seems, when closing a tab (or even disconnecting) the sessions on the DB aren't cleaned up.

      Here's a picture story on my blog for what I tried. Database was 11.2.0.4.2.

      http://www.usn-it.de/index.php/2014/05/27/oracle-sql-developer-new-window-new-session-bad-behavior/

       

      Did I miss something? Should I open an SR for that to improve the product? Id did not do any harm for me personally, but it loks a litte "unclean" in my eyes.

       

      Regards

      Martin

        • 1. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
          Gary Graham-Oracle

          Hi Martin,

           

          First off, please note that the New Worksheet to use unshared connection preference you mention in your blog, as well as the unshared worksheet icon in the worksheet toolbar, is not new for 4.0 -- that preference has been around since 3.0.

           

          Opening an SR would be fine.  For shared connections, closing a worksheet (even the last worksheet) should never close the connection as the connection's navigator tree / object browser (and perhaps the Schema Browser, Reports view, etc) might still be using it.  So it makes sense we might "forget" to close an unshared connection when its worksheet closes.  If you can prove the 3.x releases close an unshared connection automatically when its worksheet closes, then the 4.0 behavior is a regression and the SR would be especially appreciated.  If not, then what you are asking for is more of an enhancement request.

           

          Barring a bug fix / enhancement, administrators can limit the potential trouble inactive sessions might cause by defining a profile with an idle_time and connect_time limit and assigning it to existing users.

           

          Regards,

          Gary

          SQL Developer Team

           

          Message was edited by: Gary Graham

          • 2. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
            MartinKlier

            Hi Gary,

             

            thank you for the clarifications, especially regarding the version 3. Corrected it in the blog.

             

            I accept the explanation that there are more uses for a connection than just the tab. But two questions remain:

            - How can I get rid of a connection at will? Button, etc.?

            - Why does a "disconnect" on a connection not break all of them? That's a clear declaration of user's will!

             

            Best regards

            Martin Klier

            • 3. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
              Gary Graham-Oracle

              Martin,

              - How can I get rid of a connection at will? Button, etc.?

              Tools > Monitor Sessions (connect as a user having ALTER SYSTEM privilege) > right-click (on an inactive, unshared session connection) > Kill Session

              - Why does a "disconnect" on a connection not break all of them?

              Disconnect (one connection) or Disconnect Connections acts only on shared sessions, that is, the Connections navigator tree only knows about shared connections.  Once an unshared worksheet is closed, its unshared connection is not tracked explicitly and only exposed in SQL Developer through Monitor Sessions.  In fact, the more common request on this forum with respect to unshared connections is how to reconnect them should they disconnect without the end-user's permission from a network timeout or interruption, database timeout limit or session crash, etc,

               

              Both reconnect and disconnect of unshared connections fall under the category of enhancement request. I assume the disconnect issue is not a regression, but I am not absolutely certain.

               

              -Gary

              • 4. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
                Marko Sutic

                Hello Martin,

                 

                try to open new unshared worksheets using keyboard shortcut CTRL+SHIFT+N.

                Then when you close tab it successfully disconnects (at least in my environment) - SqlDeveloper Version 4.0.2.15 Buld 15.21 on Windows 7 64-bit.

                 

                When using "Open SQL Worksheet" link sessions are kept open when closing tabs.

                 

                Regards,

                Marko Sutic

                1 person found this helpful
                • 5. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
                  MartinKlier

                  Hi together,

                   

                  as Marko said,

                   

                  opening the tab with the shortcut OR the button for an unshared worksheet, the connection closes with the tab.

                   

                  But NOT when the unshared worksheet was opened by the default action (as shown in my blog)

                   

                  Seems that Gary has to do some more explanation work.

                   

                  Regards

                  Martin

                  • 6. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
                    MartinKlier

                    Hi Gary,

                     

                    does not sound like a "good" solution, more or less a workaround, isn't it?

                     

                    I don't like to complain, it's still a cool tool.

                     

                    Regards

                    Martin

                    • 7. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
                      Gary Graham-Oracle

                      OK, let's lead off with....

                      1. A worksheet opened on an unopened connection will always be shared.

                      2. In its toolbar, a shared worksheet has the Unshared SQL Worksheet button (Ctrl+Shift+N) enabled.

                      3. Closing an unshared worksheet spawned from a shared worksheet closes its associated unshared connection, a very desirable trait.

                      Now let's see what happens with the addition of some preference settings...

                      4. Even if New Worksheet to use unshared connection  and Open a Worksheet on connect preferences are both checked, the first worksheet is shared.

                      5. Also, a worksheet opened on an unopened connection by the main toolbar's SQL Worksheet button (Alt-F10) or drop-down list will shared.  All others after will be unshared.

                      6. Once a connection is opened, no new worksheet can have its Unshared SQL Worksheet button enabled, and its Ctrl+Shift+N never works.

                      7. If Open a Worksheet on connect preference is un-checked, Open SQL Worksheet from the connection's context menu will be unshared.  Connection already had to have been open!

                      So solving this orphan session issue for unshared connections would seem to require associating them with the original shared connection for that schema.  Bug or enhancement?  That is the question.

                       

                      -Gary

                      • 8. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
                        Barry Mcgillin-Oracle

                        Martin/Gary,

                        Having had a look at this and seeing your diagnosis, you are right by saying we leave a session hanging around each time we close an unshared worksheet.  An unshared worksheet is exactly that, a worksheet with a dedicated connection.  It can't be shared with another worksheet etc.  Therefore, leaving a session hanging around is a bug, which I have referenced in Bug 18853662 - forum: close unshared worksheet does not close unshared connection. 

                        I've just fixed the close part on this on our main line and on our branch as well so the next patch release will have this fix.

                        See this graphic which shows it.

                        • 9. Re: Unshared Worksheet: Not cleaning up after tab close / disconnect
                          MartinKlier

                          Barry,

                           

                          Thank you very much!

                           

                          Gary:
                          Bug

                           

                          Regards

                          Martin