Compare commits

..
18 Commits
Author SHA1 Message Date
Gina Häußge 2806676707 Preparing release of 1.3.9rc3 2018-07-16 13:15:00 +02:00
Gina Häußge 0a634a76a0 Different fix for #2632
Our original one causes dead locks as reported in #2677
2018-07-12 16:46:28 +02:00
Gina Häußge 41c0dac19d Fix state comparisons in timeout handling
We weren't yet looking at the new intermediary states here.
2018-07-12 14:40:57 +02:00
Gina Häußge f728423f29 Fix resend handling during job_on_hold
Missing response to a resent line was not properly detected and handled.
2018-07-12 14:39:45 +02:00
Gina Häußge 61e5184377 Fix "now" timestamp
Should be taken *after* reading from the serial line, not before.
2018-07-12 14:38:12 +02:00
Gina Häußge a2527998c2 Resolve dead lock issue in job_on_hold implementation
(Hopefully) closes #2677
2018-07-11 18:10:51 +02:00
Gina Häußge 386ae7609d Fix initialization order of estimator
Closes #2719
2018-07-06 16:55:05 +02:00
Gina Häußge e15946ff79 staging/maintenance is now 1.3.9rc3.dev 2018-07-06 14:34:19 +02:00
Gina Häußge fd94fc94a0 Merge branch 'staging/maintenance' into rc/maintenance 2018-07-06 13:01:31 +02:00
Gina Häußge 798bc2b225 Preparing release of 1.3.9rc2 2018-07-06 13:01:19 +02:00
Gina Häußge 6728302bb3 Preparing release of 1.3.9rc2 2018-07-06 12:55:25 +02:00
Gina Häußge f7a3e6a6ee Add --no-cache-dir flag to update pip operations
Otherwise we might run into some weird infinite loop issues within
pip's cache handling under certain circumstances, and we really
don't want to risk that in the field.

See also #2543 for another issue worked around by this, and
pypa/pip#3532 for the core issue
2018-07-06 12:08:52 +02:00
Gina Häußge 0834288cfc Fix estimator initialization on SD print start
Closes #2715
2018-07-05 10:59:14 +02:00
Gina Häußge faff20943f Capture & log any errors in the state update worker
See #2715
2018-07-05 10:58:45 +02:00
Gina Häußge a97b8c2fd9 Sanity check disabled plugin list just in case
See https://github.com/foosel/OctoPrint/issues/2687#issuecomment-399797596
2018-06-25 11:20:31 +02:00
Gina Häußge 887304fe18 Some more badges 2018-06-20 23:01:23 +02:00
Gina Häußge 2bd8aa00f3 Add build status and IRC badge 2018-06-20 20:03:19 +02:00
Gina Häußge e49a4d8cfa staging/maintenance is now 1.3.9rc2.dev 2018-06-20 15:52:00 +02:00
9 changed files with 140 additions and 67 deletions

No files matched your search

+3 -3
View File
@@ -24,10 +24,10 @@ maintenance 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
fix/.* 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
improve/.* 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.7rc5
# staging/maintenance is currently the branch for preparation of 1.3.9rc2
# so is regressionfix/...
staging/maintenance 1.3.7rc5 e5caa3d0bf77ed23f04c1d96ab0fa997d19d2006 pep440-dev
regressionfix/.* 1.3.7rc5 e5caa3d0bf77ed23f04c1d96ab0fa997d19d2006 pep440-dev
staging/maintenance 1.3.9rc3 fd94fc94a09dd91deeb2f59a6b3b00b37eb1f145 pep440-dev
regressionfix/.* 1.3.9rc3 fd94fc94a09dd91deeb2f59a6b3b00b37eb1f145 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
+31
View File
@@ -1,5 +1,36 @@
# OctoPrint Changelog
## 1.3.9rc3 (2018-07-16)
### Improvements
* Fix resend and timeout handling during an active `job_on_hold`.
### Bug fixes
* [#2677](https://github.com/foosel/OctoPrint/issues/2677) (regression) - Fix a deadlock when `job_on_hold` is utilized (causing issues at least with Octolapse)
* [#2719](https://github.com/foosel/OctoPrint/issues/2719) (regression) - Fix live print time estimation
### More information
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.9rc2...1.3.9rc3)
## 1.3.9rc2 (2018-07-06)
### Improvements
* Add sanity check for disabled plugin list (see also [#2687 (comment)](https://github.com/foosel/OctoPrint/issues/2687#issuecomment-399797596)).
* Improve logging of exceptions triggered inside the state update worker (see also [#2715](https://github.com/foosel/OctoPrint/issues/2715)).
* Workaround for a potential `pip` issue when updating components through the Software Update plugin.
### Bug fixes
* [#2715](https://github.com/foosel/OctoPrint/issues/2715) (regression) - Fix broken estimator initialization on SD print start and resulting crash of the state update worker.
### More information
* [Commits](https://github.com/foosel/OctoPrint/compare/1.3.9rc1...1.3.9rc2)
## 1.3.9rc1 (2018-06-20)
### Note for upgraders running NGINX as reverse proxy: Be sure to configure HTTP protocol version 1.1
+9 -1
View File
@@ -1,6 +1,12 @@
# OctoPrint
[![GitHub version](https://badge.fury.io/gh/foosel%2FOctoPrint.svg)](https://badge.fury.io/gh/foosel%2FOctoPrint)
![GitHub release](https://img.shields.io/github/release/foosel/OctoPrint.svg?colorB=brightgreen)
[![Travis build status](https://img.shields.io/travis/foosel/OctoPrint.svg)](https://travis-ci.org/foosel/OctoPrint)
[![Discourse topics](https://img.shields.io/discourse/https/discourse.octoprint.org/users.svg)](https://discourse.octoprint.org)
[![IRC](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://chat.octoprint.org)
[![Twitter Follow](https://img.shields.io/twitter/follow/OctoPrint3d.svg?style=social&label=Follow)](https://twitter.com/OctoPrint3d)
OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software
and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html).
@@ -9,6 +15,8 @@ Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=gi
The community forum is available at [discourse.octoprint.org](https://discourse.octoprint.org/?utm_source=github&utm_medium=readme).
The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint).
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
+5 -3
View File
@@ -1,7 +1,7 @@
# Supporters
Development of this version of OctoPrint wouldn't have been possible without
[financial support by the community](http://octoprint.org/support-octoprint/) -
[the financial support by the community](https://octoprint.org/support-octoprint/) -
thanks to everyone who contributed!
## Patreon Patrons
@@ -28,12 +28,15 @@ thanks to everyone who contributed!
* Jeff Renfer
* Jefferson Hunt
* Jeremiah Avery
* Joseph Payne
* Josh Daniels
* Joshua Wills
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
* Kodama Inc.
* Lewis Newby
* LulzBot®
* Makespace Madrid
* Mark Walker
@@ -51,11 +54,10 @@ thanks to everyone who contributed!
* Samer Najia
* Simon Hallam
* Stefan Krister
* Stephane Schittly
* Sven Mueller
* Symbiotic Devices
* Thomas Hatley
* Timothy D Hoogland
* Trent Shumay
and 1334 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
and 1333 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
@@ -672,7 +672,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
self._console_logger.debug(u"{prefix} {line}".format(**locals()))
def _mark_plugin_enabled(self, plugin, needs_restart=False):
disabled_list = list(self._settings.global_get(["plugins", "_disabled"]))
disabled_list = list(self._settings.global_get(["plugins", "_disabled"],
validator=lambda x: isinstance(x, list),
fallback=[]))
if plugin.key in disabled_list:
disabled_list.remove(plugin.key)
self._settings.global_set(["plugins", "_disabled"], disabled_list)
@@ -687,7 +689,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
self._pending_enable.add(plugin.key)
def _mark_plugin_disabled(self, plugin, needs_restart=False):
disabled_list = list(self._settings.global_get(["plugins", "_disabled"]))
disabled_list = list(self._settings.global_get(["plugins", "_disabled"],
validator=lambda x: isinstance(x, list),
fallback=[]))
if not plugin.key in disabled_list:
disabled_list.append(plugin.key)
self._settings.global_set(["plugins", "_disabled"], disabled_list)
@@ -80,7 +80,7 @@ def perform_update(target, check, target_version, log_cb=None, online=True, forc
install_arg = check["pip"].format(target_version=target_version, target=target_version)
logger.debug(u"Target: %s, executing pip install %s" % (target, install_arg))
pip_args = ["install", install_arg]
pip_args = ["install", install_arg, "--no-cache-dir"]
pip_kwargs = dict()
if pip_working_directory is not None:
pip_kwargs.update(cwd=pip_working_directory)
+37 -25
View File
@@ -82,6 +82,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self._selectedFile = None
self._estimator_factory = PrintTimeEstimator
self._estimator = None
analysis_queue_hooks = plugin_manager().get_hooks("octoprint.printer.estimation.factory")
for name, hook in analysis_queue_hooks.items():
try:
@@ -134,7 +135,17 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
eventManager().subscribe(Events.METADATA_ANALYSIS_FINISHED, self._on_event_MetadataAnalysisFinished)
eventManager().subscribe(Events.METADATA_STATISTICS_UPDATED, self._on_event_MetadataStatisticsUpdated)
def _create_estimator(self, job_type):
def _create_estimator(self, job_type=None):
if job_type is None:
with self._selectedFileMutex:
if self._selectedFile is None:
return
if self._selectedFile["sd"]:
job_type = "sdcard"
else:
job_type = "local"
self._estimator = self._estimator_factory(job_type)
#~~ handling of PrinterCallbacks
@@ -494,12 +505,6 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
if self._selectedFile is None:
return
if self._selectedFile["sd"]:
job_type = "sdcard"
else:
job_type = "local"
self._create_estimator(job_type)
self._fileManager.delete_recovery_data()
self._lastProgressReport = None
@@ -749,6 +754,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
cleanedPrintTime = self._comm.getCleanedPrintTime()
printTimeLeft = printTimeLeftOrigin = None
estimator = self._estimator
if progress is not None:
progress_int = int(progress * 100)
if self._lastProgressReport != progress_int:
@@ -761,7 +767,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
elif progress == 1.0:
printTimeLeft = 0
printTimeLeftOrigin = None
else:
elif estimator is not None:
statisticalTotalPrintTime = None
statisticalTotalPrintTimeType = None
with self._selectedFileMutex:
@@ -770,11 +776,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"]
statisticalTotalPrintTimeType = self._selectedFile.get("estimatedPrintTimeType", None)
printTimeLeft, printTimeLeftOrigin = self._estimator.estimate(progress,
printTime,
cleanedPrintTime,
statisticalTotalPrintTime,
statisticalTotalPrintTimeType)
printTimeLeft, printTimeLeftOrigin = estimator.estimate(progress,
printTime,
cleanedPrintTime,
statisticalTotalPrintTime,
statisticalTotalPrintTimeType)
return self._dict(completion=progress * 100 if progress is not None else None,
filepos=filepos,
@@ -1034,11 +1040,14 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self._setJobData(full_path, size, sd, user=user)
self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags()))
self._create_estimator()
if self._printAfterSelect:
self._printAfterSelect = False
self.start_print(pos=self._posAfterSelect, user=user)
def on_comm_print_job_started(self, suppress_script=False):
self._stateMonitor.trigger_progress_update()
payload = self._payload_for_print_job_event()
if payload:
eventManager().fire(Events.PRINT_STARTED, payload)
@@ -1305,20 +1314,23 @@ class StateMonitor(object):
self._change_event.set()
def _work(self):
while True:
self._change_event.wait()
try:
while True:
self._change_event.wait()
now = time.time()
delta = now - self._last_update
additional_wait_time = self._interval - delta
if additional_wait_time > 0:
time.sleep(additional_wait_time)
now = time.time()
delta = now - self._last_update
additional_wait_time = self._interval - delta
if additional_wait_time > 0:
time.sleep(additional_wait_time)
with self._state_lock:
data = self.get_current_data()
self._update_callback(data)
self._last_update = time.time()
self._change_event.clear()
with self._state_lock:
data = self.get_current_data()
self._update_callback(data)
self._last_update = time.time()
self._change_event.clear()
except:
logging.getLogger(__name__).exception("Looks like something crashed inside the state update worker. Please report this on the OctoPrint issue tracker (make sure to include logs!)")
def get_current_data(self):
with self._progress_lock:
+15 -10
View File
@@ -1424,17 +1424,22 @@ class Settings(object):
#~~ getter
def get(self, path, **kwargs):
error_on_path = kwargs.get("error_on_path", False)
new_kwargs = dict(kwargs)
if "error_on_path" in new_kwargs:
del new_kwargs["error_on_path"]
error_on_path = kwargs.pop("error_on_path", False)
validator = kwargs.pop("validator", None)
fallback = kwargs.pop("fallback", None)
try:
return self._get_value(path, **new_kwargs)
except NoSuchSettingsPath:
if error_on_path:
raise
return None
def process():
try:
return self._get_value(path, **kwargs)
except NoSuchSettingsPath:
if error_on_path:
raise
return None
result = process()
if callable(validator) and not validator(result):
result = fallback
return result
def getInt(self, path, **kwargs):
minimum = kwargs.pop("min", None)
+33 -22
View File
@@ -780,6 +780,9 @@ class MachineCom(object):
return self._job_on_hold.counter > 0
def set_job_on_hold(self, value, blocking=True):
trigger = False
# don't run any locking code beyond this...
if not self._job_on_hold.acquire(blocking=blocking):
return False
@@ -789,10 +792,14 @@ class MachineCom(object):
else:
self._job_on_hold.clear()
if self._job_on_hold.counter == 0:
self._continue_sending()
trigger = True
finally:
self._job_on_hold.release()
# locking code is now safe to run again
if trigger:
self._continue_sending()
return True
def close(self, is_error=False, wait=True, timeout=10.0, *args, **kwargs):
@@ -1505,11 +1512,13 @@ class MachineCom(object):
self.sayHello()
while self._monitoring_active:
now = time.time()
try:
line = self._readline()
if line is None:
break
now = time.time()
if line.strip() is not "":
self._consecutive_timeouts = 0
self._timeout = get_new_timeout("communicationBusy" if self._busy_protocol_detected else "communication", self._timeout_intervals)
@@ -1624,7 +1633,7 @@ class MachineCom(object):
handled = False
# process oks
if line.startswith("ok") or (self.isPrinting() and not self.job_on_hold and supportWait and line == "wait"):
if line.startswith("ok") or (self.isPrinting() and supportWait and line == "wait"):
# ok only considered handled if it's alone on the line, might be
# a response to an M105 or an M114
self._handle_ok()
@@ -1638,11 +1647,11 @@ class MachineCom(object):
handled = True
# process timeouts
elif ((line == "" and now > self._timeout) or (self.isPrinting()
and not self.isSdPrinting()
and not self.job_on_hold
and not self._long_running_command
and not self._heating and now > self._ok_timeout)) \
elif ((line == "" and now >= self._timeout) or (self.isPrinting()
and not self.isSdPrinting()
and (not self.job_on_hold or self._resendActive)
and not self._long_running_command
and not self._heating and now >= self._ok_timeout)) \
and (not self._blockWhileDwelling or not self._dwelling_until or now > self._dwelling_until):
# We have two timeout variants:
#
@@ -2069,21 +2078,16 @@ class MachineCom(object):
if not self._state in self.OPERATIONAL_STATES:
return
# process queues ongoing resend requests and queues if we are operational
if self._resendDelta is not None and self._resendNextCommand():
# we processed a resend request and are done here
return
with self._sendingLock: # prevent concurrency due to resend_ok_timers
if self._resendDelta is not None:
self._resendNextCommand()
else:
self._resendActive = False
self._continue_sending()
return
# continue with our queues and the job
self._resendActive = False
self._continue_sending()
def _handle_timeout(self):
if self._state not in (self.STATE_PRINTING,
self.STATE_PAUSED,
self.STATE_OPERATIONAL):
if self._state not in self.OPERATIONAL_STATES:
return
general_message = "Configure long running commands or increase communication timeout if that happens regularly on specific commands or long moves."
@@ -2091,7 +2095,7 @@ class MachineCom(object):
# figure out which consecutive timeout maximum we have to use
if self._long_running_command:
consecutive_max = self._consecutive_timeout_maximums.get("long", 0)
elif self._state in (self.STATE_PRINTING,):
elif self._state in self.PRINTING_STATES:
consecutive_max = self._consecutive_timeout_maximums.get("printing", 0)
else:
consecutive_max = self._consecutive_timeout_maximums.get("idle", 0)
@@ -2127,7 +2131,7 @@ class MachineCom(object):
# long running command active, ignore timeout
self._logger.debug("Ran into a communication timeout, but a command known to be a long runner is currently active")
elif self._state in (self.STATE_PRINTING, self.STATE_PAUSED):
elif self._state in self.PRINTING_STATES + (self.STATE_PAUSED,):
# printing, try to tickle the printer
message = "Communication timeout while printing, trying to trigger response from printer."
self._logger.info(message)
@@ -2773,6 +2777,11 @@ class MachineCom(object):
self._resendDelta = 0
self._resendDelta += 1
elif self._resendDelta is None:
# we might enter this twice in quick succession if we get triggered by the
# resend_ok_timer, so make sure that resendDelta is actually still set (see #2632)
return False
cmd = self._lastLines[-self._resendDelta]
lineNumber = self._currentLine - self._resendDelta
@@ -2780,6 +2789,8 @@ class MachineCom(object):
self._resendDelta -= 1
if self._resendDelta <= 0:
# reset everything BUT the resendActive flag - that will have to stay active until we receive
# our next ok!
self._resendDelta = None
self._lastResendNumber = None
self._currentResendCount = 0