Enhancement #5839

Timeouting (non-blocking) database requests for platform implementations requiring synchronous DB access in the UI thread

Added by Tuukka Lehtonen almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:2015-05-12
Priority:4Due date:2015-05-21
Assignee:Tuukka Lehtonen% Done:

100%

Category:-Spent time:3.00 hours
Target version:1.18.1
Release notes:Use timeouting (non-blocking) database requests for platform implementations requiring synchronous DB access in the UI thread. The timeouts can be customized at startup using the following system properties:<pre>
-Dsimantics.ui.request.start.timeout=20
-Dsimantics.ui.request.exec.timeout=50
-Dsimantics.ui.request.exec.timeout.long=100
</pre>
where the shown values are the current default values.
Tags: ui, db, lockup
Story points-
Velocity based estimate-
ReleaseSimantics 1.18.1Release relationshipAuto

Description

We want to prevent the UI from becoming unresponsive due to waiting for the database to respond to synchronous requests made in the UI thread.

#4556 implements a utility for doing timeouting synchronous database requests that can be used to implement this.


Related issues

Related to Platform - Feature #4556: Non-blocking requests for org.simantics.db.Session Closed 2013-11-18 2015-05-21
Related to Platform - Enhancement #5840: Introduce a Runnable interface that indicate read-only ta... Closed 2015-05-12 2015-05-21

Associated revisions

Revision 31274
Added by Tuukka Lehtonen almost 2 years ago

Use os.db.common.utils.RequestUtil to get timeouting database requests for platform implementations that need to perform synchronous database requests in the UI thread.

These include:
  • PropertyTesters
  • DynamicMenuContribution
  • DiagramViewerSelectionProvider

refs #5839

Revision 31279
Added by Tuukka Lehtonen almost 2 years ago

Merged trunk@31274 to branches/simantics-1.18 on 2015-05-12 for 1.18.2 release.

refs #5839

Revision 31285
Added by Tuukka Lehtonen almost 2 years ago

Fixed locking and sleeping in RequestUtil.trySyncExec.
Previous object monitor waiting was behaving really badly.
Replaced object monitors with semaphores and AtomicInteger.

refs #5839

Revision 31286
Added by Tuukka Lehtonen almost 2 years ago

Merged trunk@31285 to branches/simantics-1.18 on 2015-05-14 for 1.18.2 release.

refs #5839

Revision 32735
Added by Hannu Niemistö 12 months ago

(refs #5839) Changed request timeout to 500ms

History

#1 Updated by Tuukka Lehtonen almost 2 years ago

  • Subject changed from Timeouting (non-blocking) database requests for platform PropertyTester implementations to Timeouting (non-blocking) database requests for platform implementations requiring synchronous DB access in the UI thread

#2 Updated by Tuukka Lehtonen almost 2 years ago

Implemented in r31274.

The default timeouts for UI-thread request startup is now 20 ms and 50 ms for request completion and 100ms for "long" request completion. Long request timeout is used only in DynamicMenuContribution. The timeouts are introduced as constants in class SimanticsUI.

There is a chance that these default completion timeouts are too small and we need to change them. For workaround purposes I made the default values configurable through system properties:

    static {
        UI_THREAD_REQUEST_START_TIMEOUT = parseLongProperty("simantics.ui.request.start.timeout", 20L);
        UI_THREAD_REQUEST_EXECUTION_TIMEOUT = parseLongProperty("simantics.ui.request.exec.timeout", 50L);
        UI_THREAD_REQUEST_EXECUTION_TIMEOUT_LONG = parseLongProperty("simantics.ui.request.exec.timeout.long", 100L);
    }

#3 Updated by Tuukka Lehtonen almost 2 years ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100

#4 Updated by Tuukka Lehtonen almost 2 years ago

  • Description updated (diff)

#5 Updated by Tuukka Lehtonen almost 2 years ago

  • Status changed from Feedback to Closed
  • Release notes set to Use timeouting (non-blocking) database requests for platform implementations requiring synchronous DB access in the UI thread. The timeouts can be customized at startup using the following system properties:<pre> -Dsimantics.ui.request.start.timeout=20 -Dsimantics.ui.request.exec.timeout=50 -Dsimantics.ui.request.exec.timeout.long=100 </pre> where the shown values are the current default values.

#6 Updated by Tuukka Lehtonen almost 2 years ago

  • Target version changed from 1.18.2 to 1.18.1
  • Release changed from 33 to 17

Also available in: Atom PDF