Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

test upstream ophyd changes #3

Closed
prjemian opened this issue Oct 29, 2020 · 41 comments
Closed

test upstream ophyd changes #3

prjemian opened this issue Oct 29, 2020 · 41 comments

Comments

@prjemian
Copy link
Owner

prjemian commented Oct 29, 2020

This issue is to record the testing at APS but not on a beam line computer.

USAXS & XPCS have experienced chronic problems that limit continued, uninterrupted collection with Bluesky. At the heart of the problems are random, rare, and recurrent incidents where a PV becomes temporarily unresponsive. In Bluesky, the incidents result in a timeout that terminates the Bluesky RunEngine. When a timeout has not been set for a write operation but the target PV is unresponsive, this leaves an ophyd Status object waiting for a response that is not coming. The next time the PV is to be written, the RunEngine terminates with Another call to set() is in progress.

Several fixes have been proposed to address various aspects of these problems. The 2020-10-test branch has been created to collate these propositions to test them together. (Initial tests with just one branch proved that the different problems can occur together, interrupting the evaluation of any one particular solution.) These branches were combined here for testing the complete suite:

Pull Request URL Title
bluesky/ophyd#901 Add way to escape 'Another set in progress'.
bluesky/ophyd#922 Enh use monitor
bluesky/ophyd#926 EpicsSignal.set() timeout should default to EpicsSignal.timeout

Recent commits cover the initial testing of some of these branches individually.

Report from latest testing (compelling this branch to combine the different propositions):

2020-10-28: a440337

After thousands of scans,

uids = RE(repeat_findpeak(3000))

finding and centering on a randomly-placed peak while
collecting lots of additional baseline data,

Transient Scan ID: 8853     Time: 2020-10-28 16:03:59
Persistent Unique Scan ID: '9a9f454e-37e5-4ab3-a89f-cd9a0c6475ea'
New stream: 'baseline'
New stream: 'primary'
+-----------+------------+------------+------------+
|   seq_num |       time |         m1 |      noisy |
+-----------+------------+------------+------------+
|         1 | 16:04:00.1 |   -0.35700 | 4447.00323 |
|         2 | 16:04:00.2 |   -0.35625 | 5353.43701 |
|         3 | 16:04:00.3 |   -0.35550 | 6378.52984 |
|         4 | 16:04:00.4 |   -0.35500 | 7226.64458 |
|         5 | 16:04:00.5 |   -0.35425 | 9492.65719 |
|         6 | 16:04:00.6 |   -0.35350 | 11706.09034 |
|         7 | 16:04:00.7 |   -0.35275 | 15526.28397 |
|         8 | 16:04:00.8 |   -0.35200 | 21915.13272 |
|         9 | 16:04:00.9 |   -0.35125 | 31022.00995 |
|        10 | 16:04:01.0 |   -0.35075 | 40357.26221 |
|        11 | 16:04:01.1 |   -0.35000 | 57593.83192 |
|        12 | 16:04:01.2 |   -0.34925 | 79854.42891 |
|        13 | 16:04:01.3 |   -0.34850 | 88595.85971 |
|        14 | 16:04:01.4 |   -0.34775 | 74375.27605 |
|        15 | 16:04:01.5 |   -0.34725 | 58190.71913 |
|        16 | 16:04:01.6 |   -0.34650 | 40297.97902 |
|        17 | 16:04:01.7 |   -0.34575 | 27674.26146 |
|        18 | 16:04:01.8 |   -0.34500 | 19006.74644 |
|        19 | 16:04:01.9 |   -0.34425 | 14395.89209 |
|        20 | 16:04:02.0 |   -0.34350 | 10720.32409 |
|        21 | 16:04:02.1 |   -0.34300 | 9506.82766 |
|        22 | 16:04:02.2 |   -0.34225 | 7460.32206 |
|        23 | 16:04:02.3 |   -0.34150 | 6042.27221 |
E Wed-16:04:02 - no data in `peaks`, end of these scans
I Wed-16:04:02 - iterative results:
======= ==================== ====================
scan_id center               FWHM                
======= ==================== ====================
8850    -0.38059867113736223 0.19760960824277923 
8851    -0.35330198146781255 0.02811840189162501 
8852    -0.3491724166338197  0.005185638119912628
======= ==================== ====================

I Wed-16:04:02 - Finished #766 of 3000 iterations
+-----------+------------+------------+------------+
generator rel_scan ['9a9f454e'] (scan num: 8853)

one scan started

Transient Scan ID: 8854     Time: 2020-10-28 16:04:03
Persistent Unique Scan ID: '924b5d73-727c-404e-8c43-530155ee1bf8'
New stream: 'baseline'
New stream: 'primary'                                                                                                                                             
+-----------+------------+------------+------------+
|   seq_num |       time |         m1 |      noisy |
+-----------+------------+------------+------------+
|         1 | 16:04:06.3 |   -2.10000 |    0.43754 |
|         2 | 16:04:06.8 |   -1.90900 |    0.51906 |                                                                                                              
|         3 | 16:04:07.3 |   -1.71825 |    0.63082 |                                                                                                              
|         4 | 16:04:07.8 |   -1.52725 |    0.77017 |                                                                                                              
|         5 | 16:04:08.3 |   -1.33625 |    0.98712 |                                                                                                              
|         6 | 16:04:08.8 |   -1.14550 |    1.31004 |                                                                                                              
|         7 | 16:04:09.3 |   -0.95450 |    1.74882 |                                                                                                              
|         8 | 16:04:09.8 |   -0.76375 |    2.48313 |                                                                                                              
|         9 | 16:04:10.3 |   -0.57275 |    3.95213 |                                                                                                              
|        10 | 16:04:10.8 |   -0.38175 |    6.95915 |                                                                                                              
|        11 | 16:04:11.3 |   -0.19100 |   16.55696 |                                                                                                              
|        12 | 16:04:11.8 |    0.00000 |   70.42530 |                                                                                                              
|        13 | 16:04:12.3 |    0.19100 | 13755.87188 |                                                                                                             
|        14 | 16:04:12.8 |    0.38175 |   55.43604 |                                                                                                              
|        15 | 16:04:13.3 |    0.57275 |   14.16108 |                                                                                                              
|        16 | 16:04:13.8 |    0.76375 |    6.47230 |                                                                                                              
|        17 | 16:04:14.3 |    0.95450 |    3.74920 |                                                                                                              
|        18 | 16:04:14.8 |    1.14550 |    2.34491 |                                                                                                              
|        19 | 16:04:15.3 |    1.33625 |    1.64712 |                                                                                                              
|        20 | 16:04:15.8 |    1.52725 |    1.20580 |                                                                                                              
|        21 | 16:04:16.3 |    1.71825 |    0.92989 |                                                                                                              
|        22 | 16:04:16.8 |    1.90900 |    0.73870 |                                                                                                              
|        23 | 16:04:17.3 |    2.10000 |    0.60145 |                                                                                                              

but failed (at the end) with this console trace:

/home/beams/JEMIAN/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/epics/ca.py:1524: UserWarning: ca.get('sky:userCalcOut3.STAT') timed out after 10.00 seconds.
  warnings.warn(msg % (name(chid), timeout))
+-----------+------------+------------+------------+                                                                                                              
generator rel_scan ['924b5d73'] (scan num: 8854)
---------------------------------------------------------------------------
ReadTimeoutError                          Traceback (most recent call last)
<ipython-input-1-041856b82ed5> in <module>
----> 1 uids = RE(repeat_findpeak(3000))

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in __call__(self, *args, **metadata_kw)
    805             self._task_fut.add_done_callback(set_blocking_event)
    806 
--> 807         self._resume_task(init_func=_build_task)
    808 
    809         if self._interrupted:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _resume_task(self, init_func)
    929                     if (exc is not None
    930                             and not isinstance(exc, _RunEnginePanic)):
--> 931                         raise exc
    932 
    933     def install_suspender(self, suspender):

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
   1498             exit_reason = str(err)
   1499             self.log.exception("Run aborted")
-> 1500             raise err
   1501         finally:
   1502             if not exit_reason:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
   1363                     else:
   1364                         try:
-> 1365                             msg = self._plan_stack[-1].send(resp)
   1366                         # We have exhausted the top generator
   1367                         except StopIteration:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in __call__(self, plan)
   1305         plan = monitor_during_wrapper(plan, self.monitors)
   1306         plan = baseline_wrapper(plan, self.baseline)
-> 1307         return (yield from plan)
   1308 
   1309 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in baseline_wrapper(plan, devices, name)
   1160         return (yield from plan)
   1161     else:
-> 1162         return (yield from plan_mutator(plan, insert_baseline))
   1163 
   1164 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in monitor_during_wrapper(plan, signals)
    801     plan1 = plan_mutator(plan, insert_after_open)
    802     plan2 = plan_mutator(plan1, insert_before_close)
--> 803     return (yield from plan2)
    804 
    805 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in fly_during_wrapper(plan, flyers)
    859     plan1 = plan_mutator(plan, insert_after_open)
    860     plan2 = plan_mutator(plan1, insert_before_close)
--> 861     return (yield from plan2)
    862 
    863 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.ipython/profile_bluesky/startup/instrument/plans/example.py in repeat_findpeak(iters)
    111     # so peak finding fails.
    112     for _i in range(iters):
--> 113         apstools.utils.trim_plot_lines(bec, 4, m1, noisy)
    114         change_peak()
    115         yield from example_findpeak()

~/.ipython/profile_bluesky/startup/instrument/plans/example.py in example_findpeak(number_of_scans, number_of_points)
     76     for _again in range(number_of_scans):
     77         m1.move(cen)
---> 78         yield from bp.rel_scan([noisy], m1, -k*fwhm, k*fwhm, number_of_points)
     79         if "noisy" not in peaks["fwhm"]:
     80             logger.error("no data in `peaks`, end of these scans")

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plans.py in rel_scan(detectors, num, per_step, md, *args)
   1388                                 per_step=per_step, md=_md))
   1389 
-> 1390     return (yield from inner_rel_scan())
   1391 
   1392 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs)
   1112                 plan = gen_func(*inner_args, **inner_kwargs)
   1113                 plan = wrapper(plan, *args, **kwargs)
-> 1114                 return (yield from plan)
   1115             return dec_inner
   1116         return dec

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in reset_positions_wrapper(plan, devices)
   1117         yield Msg('wait', None, group=blk_grp)
   1118 
-> 1119     return (yield from finalize_wrapper(plan_mutator(plan, insert_reads),
   1120                                         reset()))
   1121 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in finalize_wrapper(plan, final_plan, pause_for_debug)
    507     cleanup = True
    508     try:
--> 509         ret = yield from plan
    510     except GeneratorExit:
    511         cleanup = False

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs)
   1112                 plan = gen_func(*inner_args, **inner_kwargs)
   1113                 plan = wrapper(plan, *args, **kwargs)
-> 1114                 return (yield from plan)
   1115             return dec_inner
   1116         return dec

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in relative_set_wrapper(plan, devices)
   1073     plan = plan_mutator(plan, insert_reads)
   1074     plan = msg_mutator(plan, rewrite_pos)
-> 1075     return (yield from plan)
   1076 
   1077 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in msg_mutator(plan, msg_proc)
    243                 ret = None
    244                 continue
--> 245             ret = yield msg
    246         except StopIteration as e:
    247             return e.value

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in new_gen()
    851                 yield from ensure_generator(complete_msgs)
    852                 yield from ensure_generator(collect_msgs)
--> 853                 yield msg
    854             return new_gen(), None
    855         else:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in new_gen()
    793             def new_gen():
    794                 yield from ensure_generator(unmonitor_msgs)
--> 795                 yield msg
    796             return new_gen(), None
    797         else:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in post_baseline()
   1149         elif msg.command == 'close_run':
   1150             def post_baseline():
-> 1151                 yield from trigger_and_read(devices, name=name)
   1152                 return (yield msg)
   1153 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plan_stubs.py in trigger_and_read(devices, name)
    909         return ret
    910     from .preprocessors import rewindable_wrapper
--> 911     return (yield from rewindable_wrapper(inner_trigger_and_read(),
    912                                           rewindable))
    913 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in rewindable_wrapper(plan, rewindable)
    691                                             restore_rewindable()))
    692     else:
--> 693         return (yield from plan)
    694 
    695 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plan_stubs.py in inner_trigger_and_read()
    903         ret = {}  # collect and return readings to give plan access to them
    904         for obj in devices:
--> 905             reading = (yield from read(obj))
    906             if reading is not None:
    907                 ret.update(reading)

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plan_stubs.py in read(obj)
     93         Msg('read', obj)
     94     """
---> 95     return (yield Msg('read', obj))
     96 
     97 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
   1423                         # exceptions (coming in via throw) can be
   1424                         # raised
-> 1425                         new_response = await coro(msg)
   1426 
   1427                     # special case `CancelledError` and let the outer

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _read(self, msg)
   1668         obj = msg.obj
   1669         # actually _read_ the object
-> 1670         ret = obj.read(*msg.args, **msg.kwargs)
   1671 
   1672         if ret is None:

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/device.py in read(self)
   1235 
   1236         for _, component in self._get_components_of_kind(Kind.normal):
-> 1237             res.update(component.read())
   1238         return res
   1239 

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/device.py in read(self)
   1235 
   1236         for _, component in self._get_components_of_kind(Kind.normal):
-> 1237             res.update(component.read())
   1238         return res
   1239 

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/utils/epics_pvs.py in wrapper(self, *args, **kwargs)
    196     def wrapper(self, *args, **kwargs):
    197         if self.connected:
--> 198             return fcn(self, *args, **kwargs)
    199         else:
    200             raise DisconnectedError('{} is not connected'.format(self.name))

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/signal.py in read(self)
    385             dict
    386         '''
--> 387         value = self.get()
    388         return {self.name: {'value': value,
    389                             'timestamp': self.timestamp}}

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/signal.py in get(self, as_string, timeout, connection_timeout, form, use_monitor, **kwargs)
   1142             use_monitor = self._auto_monitor
   1143 
-> 1144         info = self._get_with_timeout(
   1145             self._read_pv, timeout, connection_timeout, as_string, form, use_monitor
   1146         )

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/signal.py in _get_with_timeout(self, pv, timeout, connection_timeout, as_string, form, use_monitor)
   1096 
   1097         if info is None:
-> 1098             raise ReadTimeoutError(
   1099                 f"Failed to read {pv.pvname} "
   1100                 f"within {timeout:.2f} sec")

ReadTimeoutError: Failed to read sky:userCalcOut3.STAT within 10.00 sec

In [2]: 
@prjemian
Copy link
Owner Author

Since the previous test (a440337) for "another set() in progress" ended with a read timeout that likely would be fixed by automonitor of the PV, let's repeat that test exactly with the combination of three branches.

@prjemian
Copy link
Owner Author

In [6]: print(yaml.dump(dict(RE.md)))
beamline_id: BCDA development
login_id: jemian@wow.xray.aps.anl.gov
pid: 10816
proposal_id: testing
scan_id: 8854
versions:
  apstools: 1.3.8
  bluesky: 1.6.6
  databroker: 1.1.0
  epics: 3.4.2
  matplotlib: 3.3.1
  numpy: 1.19.1
  ophyd: 1.5.4.post18+ge3c6ff2
  pyRestTable: 2020.0.2
  spec2nexus: 2021.1.7

@prjemian
Copy link
Owner Author

restart the test

uids = RE(repeat_findpeak(3000))

@prjemian
Copy link
Owner Author

But first, use a fresh mongo database and set the default write timeout.

prjemian added a commit that referenced this issue Oct 29, 2020
@prjemian
Copy link
Owner Author

Make the new database:

(bluesky_2020_9) jemian@wow ~/.config/databroker $ /home/beams/JEMIAN/Documents/projects/BCDA-APS/use_bluesky/admin/make_catalog.py otz.xray.aps.anl.gov prj
wrote: prj.yml
prj: installing version sentinels
runs in the catalog: 0

@prjemian
Copy link
Owner Author

started the test, 236 iterations so far

@prjemian
Copy link
Owner Author

11:47 pm, 1228 iterations, no problems observed

@prjemian
Copy link
Owner Author

prjemian commented Oct 30, 2020

test failed with timeout during iteration 1378:

Transient Scan ID: 14385     Time: 2020-10-30 01:20:26
Persistent Unique Scan ID: 'ea987e66-e5a7-4fc9-b2f7-9fc5b05d786d'
/home/beams/JEMIAN/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/epics/ca.py:1524: UserWarning: ca.get('sky:userCalcOut5.NSEV') timed out after 10.00 seconds.
  warnings.warn(msg % (name(chid), timeout))
---------------------------------------------------------------------------
ReadTimeoutError                          Traceback (most recent call last)
<ipython-input-5-041856b82ed5> in <module>
----> 1 uids = RE(repeat_findpeak(3000))

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in __call__(self, *args, **metadata_kw)
    805             self._task_fut.add_done_callback(set_blocking_event)
    806 
--> 807         self._resume_task(init_func=_build_task)
    808 
    809         if self._interrupted:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _resume_task(self, init_func)
    929                     if (exc is not None
    930                             and not isinstance(exc, _RunEnginePanic)):
--> 931                         raise exc
    932 
    933     def install_suspender(self, suspender):

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
   1498             exit_reason = str(err)
   1499             self.log.exception("Run aborted")
-> 1500             raise err
   1501         finally:
   1502             if not exit_reason:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
   1363                     else:
   1364                         try:
-> 1365                             msg = self._plan_stack[-1].send(resp)
   1366                         # We have exhausted the top generator
   1367                         except StopIteration:

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in __call__(self, plan)
   1305         plan = monitor_during_wrapper(plan, self.monitors)
   1306         plan = baseline_wrapper(plan, self.baseline)
-> 1307         return (yield from plan)
   1308 
   1309 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in baseline_wrapper(plan, devices, name)
   1160         return (yield from plan)
   1161     else:
-> 1162         return (yield from plan_mutator(plan, insert_baseline))
   1163 
   1164 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in monitor_during_wrapper(plan, signals)
    801     plan1 = plan_mutator(plan, insert_after_open)
    802     plan2 = plan_mutator(plan1, insert_before_close)
--> 803     return (yield from plan2)
    804 
    805 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in fly_during_wrapper(plan, flyers)
    859     plan1 = plan_mutator(plan, insert_after_open)
    860     plan2 = plan_mutator(plan1, insert_before_close)
--> 861     return (yield from plan2)
    862 
    863 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    168                     continue
    169                 else:
--> 170                     raise ex
    171         # if inserting / mutating, put new generator on the stack
    172         # and replace the current msg with the first element from the

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    121             ret = result_stack.pop()
    122             try:
--> 123                 msg = plan_stack[-1].send(ret)
    124             except StopIteration as e:
    125                 # discard the exhausted generator

~/.ipython/profile_bluesky/startup/instrument/plans/example.py in repeat_findpeak(iters)
    113         apstools.utils.trim_plot_lines(bec, 4, m1, noisy)
    114         change_peak()
--> 115         yield from example_findpeak()
    116         logger.info("Finished #%d of %d iterations", _i+1, iters)
    117     # bec.enable_plots()

~/.ipython/profile_bluesky/startup/instrument/plans/example.py in example_findpeak(number_of_scans, number_of_points)
     76     for _again in range(number_of_scans):
     77         m1.move(cen)
---> 78         yield from bp.rel_scan([noisy], m1, -k*fwhm, k*fwhm, number_of_points)
     79         if "noisy" not in peaks["fwhm"]:
     80             logger.error("no data in `peaks`, end of these scans")

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plans.py in rel_scan(detectors, num, per_step, md, *args)
   1388                                 per_step=per_step, md=_md))
   1389 
-> 1390     return (yield from inner_rel_scan())
   1391 
   1392 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs)
   1112                 plan = gen_func(*inner_args, **inner_kwargs)
   1113                 plan = wrapper(plan, *args, **kwargs)
-> 1114                 return (yield from plan)
   1115             return dec_inner
   1116         return dec

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in reset_positions_wrapper(plan, devices)
   1117         yield Msg('wait', None, group=blk_grp)
   1118 
-> 1119     return (yield from finalize_wrapper(plan_mutator(plan, insert_reads),
   1120                                         reset()))
   1121 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in finalize_wrapper(plan, final_plan, pause_for_debug)
    507     cleanup = True
    508     try:
--> 509         ret = yield from plan
    510     except GeneratorExit:
    511         cleanup = False

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/utils.py in dec_inner(*inner_args, **inner_kwargs)
   1112                 plan = gen_func(*inner_args, **inner_kwargs)
   1113                 plan = wrapper(plan, *args, **kwargs)
-> 1114                 return (yield from plan)
   1115             return dec_inner
   1116         return dec

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in relative_set_wrapper(plan, devices)
   1073     plan = plan_mutator(plan, insert_reads)
   1074     plan = msg_mutator(plan, rewrite_pos)
-> 1075     return (yield from plan)
   1076 
   1077 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in msg_mutator(plan, msg_proc)
    243                 ret = None
    244                 continue
--> 245             ret = yield msg
    246         except StopIteration as e:
    247             return e.value

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/utils.py in single_gen(msg)
    139         the input message
    140     '''
--> 141     return (yield msg)
    142 
    143 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/utils.py in single_gen(msg)
    139         the input message
    140     '''
--> 141     return (yield msg)
    142 
    143 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
     76             # if we have a stashed exception, pass it along
     77             try:
---> 78                 msg = plan_stack[-1].throw(exception)
     79             except StopIteration as e:
     80                 # discard the exhausted generator

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plan_stubs.py in trigger_and_read(devices, name)
    909         return ret
    910     from .preprocessors import rewindable_wrapper
--> 911     return (yield from rewindable_wrapper(inner_trigger_and_read(),
    912                                           rewindable))
    913 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in rewindable_wrapper(plan, rewindable)
    691                                             restore_rewindable()))
    692     else:
--> 693         return (yield from plan)
    694 
    695 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plan_stubs.py in inner_trigger_and_read()
    903         ret = {}  # collect and return readings to give plan access to them
    904         for obj in devices:
--> 905             reading = (yield from read(obj))
    906             if reading is not None:
    907                 ret.update(reading)

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/plan_stubs.py in read(obj)
     93         Msg('read', obj)
     94     """
---> 95     return (yield Msg('read', obj))
     96 
     97 

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/preprocessors.py in plan_mutator(plan, msg_proc)
    193         try:
    194             # yield out the 'current message' and collect the return
--> 195             inner_ret = yield msg
    196         except GeneratorExit:
    197             # special case GeneratorExit.  We must clean up all of our plans

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _run(self)
   1423                         # exceptions (coming in via throw) can be
   1424                         # raised
-> 1425                         new_response = await coro(msg)
   1426 
   1427                     # special case `CancelledError` and let the outer

~/.conda/envs/bluesky_2020_9/lib/python3.8/site-packages/bluesky/run_engine.py in _read(self, msg)
   1668         obj = msg.obj
   1669         # actually _read_ the object
-> 1670         ret = obj.read(*msg.args, **msg.kwargs)
   1671 
   1672         if ret is None:

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/device.py in read(self)
   1235 
   1236         for _, component in self._get_components_of_kind(Kind.normal):
-> 1237             res.update(component.read())
   1238         return res
   1239 

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/device.py in read(self)
   1235 
   1236         for _, component in self._get_components_of_kind(Kind.normal):
-> 1237             res.update(component.read())
   1238         return res
   1239 

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/utils/epics_pvs.py in wrapper(self, *args, **kwargs)
    196     def wrapper(self, *args, **kwargs):
    197         if self.connected:
--> 198             return fcn(self, *args, **kwargs)
    199         else:
    200             raise DisconnectedError('{} is not connected'.format(self.name))

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/signal.py in read(self)
    414             dict
    415         '''
--> 416         value = self.get()
    417         return {self.name: {'value': value,
    418                             'timestamp': self.timestamp}}

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/signal.py in get(self, as_string, timeout, connection_timeout, form, use_monitor, **kwargs)
   1174             use_monitor = self._auto_monitor
   1175 
-> 1176         info = self._get_with_timeout(
   1177             self._read_pv, timeout, connection_timeout, as_string, form, use_monitor
   1178         )

/home/beams1/JEMIAN/Documents/projects/Bluesky/ophyd/ophyd/signal.py in _get_with_timeout(self, pv, timeout, connection_timeout, as_string, form, use_monitor)
   1128 
   1129         if info is None:
-> 1130             raise ReadTimeoutError(
   1131                 f"Failed to read {pv.pvname} "
   1132                 f"within {timeout:.2f} sec")

ReadTimeoutError: Failed to read sky:userCalcOut5.NSEV within 10.00 sec

@prjemian
Copy link
Owner Author

Need to make sure auto_monitor is True!

@prjemian
Copy link
Owner Author

Now there's the problem. auto_monitor=False:

In [7]: calcouts.calcout5.new_alarm_severity.get()
Out[7]: 0

In [8]: calcouts.calcout5.new_alarm_severity.read()
Out[8]: 
{'calcouts_calcout5_new_alarm_severity': {'value': 0,
  'timestamp': 631152000.0}}

In [9]: calcouts.calcout5.new_alarm_severity.read()
Out[9]: 
{'calcouts_calcout5_new_alarm_severity': {'value': 0,
  'timestamp': 631152000.0}}

In [10]: calcouts.calcout5.new_alarm_severity
Out[10]: EpicsSignalRO(read_pv='sky:userCalcOut5.NSEV', name='calcouts_calcout5_new_alarm_severity', parent='calcouts_calcout5', value=0, timestamp=631152000.0, auto_monitor=False, string=False)

@prjemian
Copy link
Owner Author

This setting must happen in the upstream package (apstools) where the Component is defined. That's a lot of work.

@prjemian
Copy link
Owner Author

Re-start testing with apstools branch: 450-auto_monitor

@prjemian
Copy link
Owner Author

startup bluesky ...

I Fri-03:25:37 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/signals.py
I Fri-03:25:37 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/simdet.py
I Fri-03:25:37 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/devices/simulators.py
W Fri-03:25:37 - reset `calc2` since `registers` not available
I Fri-03:25:37 - /home/beams/JEMIAN/.ipython/profile_bluesky/startup/instrument/plans/example.py

In [1]: calcouts.calcout5.new_alarm_severity._auto_monitor
Out[1]: True

@prjemian
Copy link
Owner Author

In [2]: import yaml

In [3]: print(yaml.dump(dict(RE.md)))
beamline_id: BCDA development
login_id: jemian@wow.xray.aps.anl.gov
pid: 3386
proposal_id: testing
scan_id: 14385
versions:
  apstools: 1.3.8+1.g8e336b9
  bluesky: 1.6.6
  databroker: 1.1.0
  epics: 3.4.2
  matplotlib: 3.3.1
  numpy: 1.19.1
  ophyd: 1.5.4.post18+ge3c6ff2
  pyRestTable: 2020.0.2
  spec2nexus: 2021.1.7

@prjemian
Copy link
Owner Author

Added code to set a default _auto_monitor for EpicsSignalBase similar to timeouts: bluesky/ophyd#927

@prjemian
Copy link
Owner Author

|2020-10-30 14:41:42.075|INFO|3386|bluesky-session|example|116|bluesky-run-engine| - Finished #1253 of 3000 iterations

@prjemian
Copy link
Owner Author

Things were progressing just fine:

|2020-10-31 03:40:36.303|INFO|3386|bluesky-session|example|116|bluesky-run-engine| - Finished #2674 of 3000 iterations
|2020-10-31 03:41:13.152|INFO|3386|bluesky-session|example|116|bluesky-run-engine| - Finished #2675 of 3000 iterations
|2020-10-31 03:41:45.498|INFO|3386|bluesky-session|example|116|bluesky-run-engine| - Finished #2676 of 3000 iterations
|2020-10-31 03:42:18.574|INFO|3386|bluesky-session|example|116|bluesky-run-engine| - Finished #2677 of 3000 iterations
|2020-10-31 03:42:55.875|INFO|3386|bluesky-session|example|116|bluesky-run-engine| - Finished #2678 of 3000 iterations

But then this happened in the middle of a scan (ending everything):

Transient Scan ID: 25101     Time: 2020-10-31 03:43:34
Persistent Unique Scan ID: 'feb0928e-b522-4f52-8c67-d94baaa5a31e'
New stream: 'baseline'
New stream: 'primary'                                                                                                                 
+-----------+------------+------------+------------+                                                                                  
|   seq_num |       time |         m1 |      noisy |
+-----------+------------+------------+------------+
|         1 | 03:43:36.2 |   -0.35650 | 5191.94736 |
|         2 | 03:43:36.7 |   -0.35425 | 6150.07773 |
|         3 | 03:43:37.0 |   -0.35200 | 7727.98373 |
|         4 | 03:43:37.0 |   -0.35000 | 9259.97486 |
|         5 | 03:43:37.1 |   -0.34775 | 11331.60794 |
|         6 | 03:43:37.5 |   -0.34550 | 15281.66632 |
|         7 | 03:43:37.5 |   -0.34325 | 20462.08139 |
|         8 | 03:43:37.6 |   -0.34100 | 29053.10453 |
|         9 | 03:43:37.7 |   -0.33875 | 40977.62395 |
|        10 | 03:43:37.8 |   -0.33675 | 58497.19045 |
|        11 | 03:43:37.9 |   -0.33450 | 80416.75409 |
|        12 | 03:43:38.2 |   -0.33225 | 94785.84220 |
|        13 | 03:43:38.2 |   -0.33000 | 82545.97599 |
|        14 | 03:43:38.3 |   -0.32775 | 60270.87883 |
|        15 | 03:43:38.8 |   -0.32575 | 43208.20672 |
|        16 | 03:43:38.8 |   -0.32350 | 30145.73116 |
|        17 | 03:43:38.9 |   -0.32125 | 20799.45956 |
|        18 | 03:43:39.0 |   -0.31900 | 15648.42545 |
|        19 | 03:43:39.1 |   -0.31675 | 12082.37221 |
|        20 | 03:43:39.2 |   -0.31450 | 9613.23398 |
|        21 | 03:43:39.3 |   -0.31250 | 7580.60297 |
|        22 | 03:43:39.4 |   -0.31025 | 6320.09886 |
|        23 | 03:43:39.6 |   -0.30800 | 5282.50495 |
/home/beams/JEMIAN/bin/blueskyJemian.sh: line 17:  3386 Killed                  ipython ${OPTIONS}
(bluesky_2020_9) jemian@wow /tmp $ 

Nothing in the logs describes what happened.

@prjemian
Copy link
Owner Author

Checking the system logs, they are read-restricted. dmesg shows this reason : Out of memory

[6921109.096871] EracentEPAServi invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
[6921109.096875] EracentEPAServi cpuset=/ mems_allowed=0
[6921109.096877] CPU: 5 PID: 2784 Comm: EracentEPAServi Kdump: loaded Tainted: G               ------------ T 3.10.0-1127.18.2.el7.x86_64 #1
[6921109.096878] Hardware name: HP HP EliteDesk 800 G4 SFF/83E1, BIOS Q01 Ver. 02.04.01 09/13/2018
[6921109.096879] Call Trace:
[6921109.096885]  [<ffffffffa317ffa5>] dump_stack+0x19/0x1b
[6921109.096887]  [<ffffffffa317a8c3>] dump_header+0x90/0x229
[6921109.096890]  [<ffffffffa2b06d32>] ? ktime_get_ts64+0x52/0xf0
[6921109.096894]  [<ffffffffa2bc251e>] oom_kill_process+0x25e/0x3f0
[6921109.096896]  [<ffffffffa2b33a51>] ? cpuset_mems_allowed_intersects+0x21/0x30
[6921109.096898]  [<ffffffffa2bc1f7d>] ? oom_unkillable_task+0xcd/0x120
[6921109.096900]  [<ffffffffa2bc2026>] ? find_lock_task_mm+0x56/0xc0
[6921109.096902]  [<ffffffffa2bc2d76>] out_of_memory+0x4b6/0x4f0
[6921109.096904]  [<ffffffffa317b3e0>] __alloc_pages_slowpath+0x5db/0x729
[6921109.096907]  [<ffffffffa2bc91f6>] __alloc_pages_nodemask+0x436/0x450
[6921109.096909]  [<ffffffffa2c18ea8>] alloc_pages_current+0x98/0x110
[6921109.096911]  [<ffffffffa2bbe427>] __page_cache_alloc+0x97/0xb0
[6921109.096914]  [<ffffffffa2bc0fe0>] filemap_fault+0x270/0x420
[6921109.096940]  [<ffffffffc04f798e>] __xfs_filemap_fault+0x7e/0x1d0 [xfs]
[6921109.096956]  [<ffffffffc04f7b8c>] xfs_filemap_fault+0x2c/0x30 [xfs]
[6921109.096958]  [<ffffffffa2bedf6a>] __do_fault.isra.61+0x8a/0x100
[6921109.096961]  [<ffffffffa2bee51c>] do_read_fault.isra.63+0x4c/0x1b0
[6921109.096963]  [<ffffffffa2bf5d80>] handle_mm_fault+0xa20/0xfb0
[6921109.096965]  [<ffffffffa318d653>] __do_page_fault+0x213/0x500
[6921109.096967]  [<ffffffffa318d975>] do_page_fault+0x35/0x90
[6921109.096969]  [<ffffffffa3189778>] page_fault+0x28/0x30
[6921109.096971] Mem-Info:
[6921109.096974] active_anon:3360119 inactive_anon:444065 isolated_anon:0
 active_file:4763 inactive_file:6086 isolated_file:0
 unevictable:4 dirty:0 writeback:0 unstable:0
 slab_reclaimable:56681 slab_unreclaimable:27323
 mapped:7031 shmem:5239 pagetables:29942 bounce:0
 free:33517 free_pcp:29 free_cma:0
[6921109.096978] Node 0 DMA free:15892kB min:64kB low:80kB high:96kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15992kB managed:15908kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:16kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[6921109.096982] lowmem_reserve[]: 0 2874 15647 15647
[6921109.096985] Node 0 DMA32 free:63124kB min:12400kB low:15500kB high:18600kB active_anon:2127612kB inactive_anon:547420kB active_file:17528kB inactive_file:19292kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:3174064kB managed:2943624kB mlocked:0kB dirty:0kB writeback:0kB mapped:9848kB shmem:2828kB slab_reclaimable:114856kB slab_unreclaimable:16540kB kernel_stack:5008kB pagetables:19180kB unstable:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:62407 all_unreclaimable? yes
[6921109.096989] lowmem_reserve[]: 0 0 12772 12772
[6921109.096991] Node 0 Normal free:55052kB min:55112kB low:68888kB high:82668kB active_anon:11312864kB inactive_anon:1228840kB active_file:1524kB inactive_file:5052kB unevictable:16kB isolated(anon):0kB isolated(file):0kB present:13361152kB managed:13082332kB mlocked:16kB dirty:0kB writeback:0kB mapped:18276kB shmem:18128kB slab_reclaimable:111868kB slab_unreclaimable:92736kB kernel_stack:21728kB pagetables:100588kB unstable:0kB bounce:0kB free_pcp:116kB local_pcp:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:78 all_unreclaimable? no
[6921109.096995] lowmem_reserve[]: 0 0 0 0
[6921109.096997] Node 0 DMA: 1*4kB (U) 0*8kB 1*16kB (U) 0*32kB 2*64kB (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (M) 3*4096kB (M) = 15892kB
[6921109.097004] Node 0 DMA32: 13325*4kB (UEM) 1421*8kB (UM) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 64668kB
[6921109.097010] Node 0 Normal: 14001*4kB (UM) 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 56004kB
[6921109.097015] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
[6921109.097018] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
[6921109.097019] 34840 total pagecache pages
[6921109.097021] 18229 pages in swap cache
[6921109.097022] Swap cache stats: add 24803380, delete 24784190, find 27008609/34944679
[6921109.097023] Free swap  = 0kB
[6921109.097024] Total swap = 8126460kB
[6921109.097025] 4137802 pages RAM
[6921109.097026] 0 pages HighMem/MovableOnly
[6921109.097026] 127336 pages reserved
[6921109.097027] [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name
[6921109.097035] [  654]     0   654    21288       49      47      230             0 systemd-journal
[6921109.097038] [  672]     0   672    49643        0      31      106             0 lvmetad
[6921109.097040] [  687]     0   687    11454        2      26      323         -1000 systemd-udevd
[6921109.097043] [ 1070]     0  1070    13883       27      27       96         -1000 auditd
[6921109.097045] [ 1072]     0  1072    21139       24      12       48             0 audispd
[6921109.097047] [ 1074]     0  1074    13911       32      33       74             0 sedispatch
[6921109.097049] [ 1099]     0  1099     1885        1       9       28             0 gpm
[6921109.097050] [ 1100]   498  1100     1667        8       9       26             0 lsmd
[6921109.097052] [ 1103]    32  1103    17320       16      37      138             0 rpcbind
[6921109.097054] [ 1113]    28  1113   396024      121      65      128             0 nscd
[6921109.097056] [ 1124]    81  1124    14916      666      32      189          -900 dbus-daemon
[6921109.097058] [ 1125]     0  1125     1097        1       8       34             0 acpid
[6921109.097060] [ 1129]     0  1129     6226       99      16      130             0 systemd-logind
[6921109.097062] [ 1144]     0  1144   107650       92      79      276             0 ModemManager
[6921109.097064] [ 1152]     0  1152     4225        7      14       54             0 alsactl
[6921109.097065] [ 1168]     0  1168     5417       62      15       39             0 irqbalance
[6921109.097067] [ 1180]     0  1180    13213       45      30      174             0 smartd
[6921109.097069] [ 1190]     0  1190   128794      187      81      292             0 udisksd
[6921109.097070] [ 1193]     0  1193    22642        1      47      229             0 rngd
[6921109.097072] [ 1195]     0  1195   100081      128      49      985             0 accounts-daemon
[6921109.097074] [ 1196]   499  1196   155222      761      68     2738             0 polkitd
[6921109.097076] [ 1216]   172  1216    49224        0      32      116             0 rtkit-daemon
[6921109.097078] [ 1217]    38  1217     6061       55      15      115             0 ntpd
[6921109.097080] [ 1253]     0  1253     1304        1       8       32             0 mcelog
[6921109.097082] [ 1277]     0  1277   140510      188      88      404             0 NetworkManager
[6921109.097084] [ 1280]     0  1280    28471      143      12       17             0 ksmtuned
[6921109.097086] [ 1360]     0  1360    25248        1      52      516             0 dhclient
[6921109.097088] [ 1634]     0  1634   174918       40      33      742             0 EracentEUAServi
[6921109.097089] [ 1635]     0  1635   247457      996     161     5897             0 python
[6921109.097091] [ 1641]     0  1641   146194      105     101     3806             0 tuned
[6921109.097093] [ 1650]     0  1650   227448       84      53     5169             0 EracentEPAServi
[6921109.097095] [ 1654]     0  1654    27859        0      58      262         -1000 sshd
[6921109.097097] [ 1658]     0  1658    62609       48      28      238             0 rsyslogd
[6921109.097099] [ 1660]     0  1660    28953       21      13       19             0 rhsmcertd
[6921109.097101] [ 1675]    65  1675   110957      127      49      855             0 nslcd
[6921109.097103] [ 1676]     2  1676     6835        7      14       49             0 caRepeater
[6921109.097105] [ 1685]    29  1685    10681        0      25      237             0 rpc.statd
[6921109.097106] [ 1690]     0  1690    71041     5420      92    15742             0 cupsd
[6921109.097108] [ 1697]     0  1697    68836     2043      70     1347             0 cups-browsed
[6921109.097110] [ 1715]     0  1715   319601     1452      83     5942             0 containerd
[6921109.097112] [ 1870]   478  1870   150025    40755     195    22065             0 nxserver.bin
[6921109.097114] [ 1986]     0  1986   173801       69      87      886             0 automount
[6921109.097116] [ 1999]     0  1999   250137        1     149     1218             0 libvirtd
[6921109.097118] [ 2035]     0  2035     6052        0      18       53             0 atd
[6921109.097120] [ 2053]     0  2053    31119       20      17      129             0 crond
[6921109.097122] [ 2357]   488  2357   104773        1      59      908             0 colord
[6921109.097124] [ 2372]     0  2372   138366        0      56      281             0 gdm
[6921109.097125] [ 2430]     0  2430    22106       18      40      243             0 master
[6921109.097127] [ 2432]    89  2432    22096       17      42      237             0 qmgr
[6921109.097129] [ 3365]     4  3365    21915        0      47      237             0 dbus
[6921109.097130] [ 7048]     0  7048   109041     4277     139     4635             0 X
[6921109.097132] [ 7163]   483  7163   245427     1070      84     8169             0 mongod
[6921109.097134] [ 7412]     0  7412    93768        0      71      314             0 gdm-session-wor
[6921109.097136] [ 7523]    42  7523   167793      137     103      483             0 gnome-session-b
[6921109.097138] [ 7681]    42  7681    14282        1      30      121             0 dbus-launch
[6921109.097140] [ 7718]    42  7718    14184        0      30      202             0 dbus-daemon
[6921109.097142] [ 7893]    42  7893    86702        0      38      691             0 at-spi-bus-laun
[6921109.097143] [ 7947]    42  7947    14076        2      33      119             0 dbus-daemon
[6921109.097145] [ 8007]    42  8007    58306        0      50      208             0 at-spi2-registr
[6921109.097147] [ 8319]    42  8319  1050034    15084     449    23196             0 gnome-shell
[6921109.097149] [ 8398]     0  8398   107582       86      60      249             0 upowerd
[6921109.097151] [ 8567]    42  8567   313082        2      85      707             0 pulseaudio
[6921109.097153] [ 8689]   478  8689   192798        1      44      749             0 nxd
[6921109.097155] [ 8692]   477  8692     9554       51      23      465             0 nxhtd.bin
[6921109.097156] [ 8807]   477  8807  2061892        0     360     4182             0 nxhtd.bin
[6921109.097158] [ 9906]    42  9906   112863       37      39     1074             0 ibus-daemon
[6921109.097160] [ 9926]    42  9926    93995        0      36      679             0 ibus-dconf
[6921109.097162] [ 9929]    42  9929   116215        0     111     1242             0 ibus-x11
[6921109.097164] [ 9933]    42  9933    93989        0      36      162             0 ibus-portal
[6921109.097166] [ 9968]    42  9968    91175        0      31      130             0 xdg-permission-
[6921109.097167] [10092]     0 10092    99196       89      48      145             0 boltd
[6921109.097169] [10130]     0 10130    19671       15      42      191             0 wpa_supplicant
[6921109.097171] [10173]    42 10173   154048        0     119     1480             0 gsd-xsettings
[6921109.097173] [10175]    42 10175    94120        0      37      177             0 gsd-a11y-settin
[6921109.097175] [10178]    42 10178   116120        0     111     1260             0 gsd-clipboard
[6921109.097177] [10183]    42 10183   182247     5851     142     2001             0 gsd-color
[6921109.097179] [10196]    42 10196   116376        0     103      511             0 gsd-datetime
[6921109.097181] [10198]    42 10198    95178        0      40      155             0 gsd-housekeepin
[6921109.097183] [10199]    42 10199   153561        0     120     1270             0 gsd-keyboard
[6921109.097184] [10200]    42 10200   232062      152     142     1736             0 gsd-media-keys
[6921109.097186] [10205]    42 10205    75111        0      33      138             0 gsd-mouse
[6921109.097188] [10227]    42 10227   157469      162     123     1664             0 gsd-power
[6921109.097190] [10228]    42 10228    90798        0      62      287             0 gsd-print-notif
[6921109.097192] [10230]    42 10230    79418        0      40      157             0 gsd-rfkill
[6921109.097194] [10232]    42 10232    93545        0      34      149             0 gsd-screensaver
[6921109.097196] [10241]    42 10241   102872        0      52      251             0 gsd-sharing
[6921109.097198] [10242]    42 10242   118080        0      47      255             0 gsd-smartcard
[6921109.097199] [10257]    42 10257   113750        0      72      296             0 gsd-sound
[6921109.097201] [10258]    42 10258   137321        0     116     1817             0 gsd-wacom
[6921109.097203] [10777]    42 10777    75540        0      35      164             0 ibus-engine-sim
[6921109.097204] [13681]   478 13681    26884        2      58      192             0 nxexec
[6921109.097206] [13689]    42 13689   388406     1210     145     9919             0 nxnode.bin
[6921109.097208] [29404]   478 29404    26884        2      58      191             0 nxexec
[6921109.097210] [29412]  2335 29412   849057     6547     278    18430             0 nxnode.bin
[6921109.097212] [29452]   478 29452   149310      683      88    15111             0 nxserver.bin
[6921109.097214] [29583]  2335 29583   167890      162     104      532             0 gnome-session-b
[6921109.097215] [29688]  2335 29688   314848       38     101      902             0 pulseaudio
[6921109.097217] [29691]  2335 29691    14249        1      32      114             0 dbus-launch
[6921109.097219] [29692]  2335 29692   416930      692     157     6617             0 nxclient.bin
[6921109.097221] [29697]  2335 29697    14310        1      31      360             0 dbus-daemon
[6921109.097223] [29709]  2335 29709    46888        0      27      172             0 dconf-service
[6921109.097225] [29754]  2335 29754    86700        0      37      177             0 at-spi-bus-laun
[6921109.097226] [29762]  2335 29762    14108        2      32      130             0 dbus-daemon
[6921109.097228] [29764]  2335 29764    58278        0      49      205             0 at-spi2-registr
[6921109.097230] [29769]  2335 29769    97181        0      43      725             0 gvfsd
[6921109.097232] [29776]  2335 29776    88070        0      37      708             0 gvfsd-fuse
[6921109.097233] [29810]  2335 29810    79348        0      36      243             0 gnome-keyring-d
[6921109.097235] [29821]  2335 29821  1140282    19827     501    37418             0 gnome-shell
[6921109.097237] [29902]  2335 29902    92862        0      35      154             0 xdg-permission-
[6921109.097239] [29907]  2335 29907   162023        0     108     1339             0 gnome-shell-cal
[6921109.097241] [29914]  2335 29914   360607        0     186     1244             0 evolution-sourc
[6921109.097243] [29927]  2335 29927   223328        0     164     2060             0 goa-daemon
[6921109.097245] [29944]  2335 29944   133582       16     109      518             0 goa-identity-se
[6921109.097247] [29950]  2335 29950   102912       99      68      813             0 mission-control
[6921109.097249] [29955]  2335 29955   105189     1344      57      710             0 gvfs-udisks2-vo
[6921109.097251] [29964]  2335 29964    92888        0      33      166             0 gvfs-goa-volume
[6921109.097252] [29976]  2335 29976   119628        0      51      776             0 gvfs-afc-volume
[6921109.097254] [29987]  2335 29987   100172        0      48      727             0 gvfs-gphoto2-vo
[6921109.097256] [29992]  2335 29992    97899        0      44      185             0 gvfs-mtp-volume
[6921109.097258] [30035]  2335 30035   157418      175     126     1657             0 gsd-power
[6921109.097260] [30037]  2335 30037   110541      108      67      686             0 gsd-print-notif
[6921109.097262] [30038]  2335 30038   134717        0      48      706             0 gsd-rfkill
[6921109.097264] [30039]  2335 30039    93545        0      35      155             0 gsd-screensaver
[6921109.097266] [30040]  2335 30040   139769        0      57      369             0 gsd-sharing
[6921109.097267] [30041]  2335 30041   154023        0     119     1976             0 gsd-xsettings
[6921109.097270] [30046]  2335 30046   137293        0     123     1309             0 gsd-wacom
[6921109.097277] [30047]  2335 30047   118078        0      48      258             0 gsd-smartcard
[6921109.097279] [30049]  2335 30049   113748        0      72      306             0 gsd-sound
[6921109.097281] [30053]  2335 30053   114200        0      41      207             0 gsd-account
[6921109.097283] [30065]  2335 30065    94143        0      35      687             0 gsd-a11y-settin
[6921109.097285] [30066]  2335 30066   116091        0     109     1213             0 gsd-clipboard
[6921109.097287] [30069]  2335 30069   181974     5570     139     1905             0 gsd-color
[6921109.097288] [30076]  2335 30076   135384        0     108      536             0 gsd-datetime
[6921109.097290] [30077]  2335 30077   115900      111      45      146             0 gsd-housekeepin
[6921109.097292] [30079]  2335 30079   153526        0     112     1252             0 gsd-keyboard
[6921109.097294] [30082]  2335 30082   248379      169     140     1682             0 gsd-media-keys
[6921109.097296] [30085]  2335 30085    94119        0      37      208             0 gsd-mouse
[6921109.097298] [30115]  2335 30115   152156        0     106      533             0 gsd-printer
[6921109.097300] [30151]  2335 30151   184176        0     108     1530             0 tracker-extract
[6921109.097301] [30153]  2335 30153   158145        0      87     1389             0 tracker-miner-a
[6921109.097303] [30154]  2335 30154   231926        0     102     1487             0 tracker-miner-f
[6921109.097305] [30157]  2335 30157   140490        0      83      722             0 tracker-miner-u
[6921109.097307] [30165]  2335 30165    28385      120      12       22             0 restarter
[6921109.097309] [30170]  2335 30170    68265        0      36      248             0 gsd-disk-utilit
[6921109.097311] [30172]  2335 30172    98020        0      47     1791             0 imsettings-daem
[6921109.097313] [30204]     0 30204    20902        0      44      192             0 clevis-luks-udi
[6921109.097315] [30223]  2335 30223    57834        0      47      283             0 clevis-luks-udi
[6921109.097317] [30404]  2335 30404   112923       28      40      622             0 ibus-daemon
[6921109.097318] [30409]  2335 30409    93988        0      37      179             0 ibus-dconf
[6921109.097320] [30410]  2335 30410   136457        0     119     1493             0 ibus-ui-gtk3
[6921109.097322] [30414]  2335 30414   116133        0     112     1183             0 ibus-x11
[6921109.097324] [30417]  2335 30417    93989        0      37      163             0 ibus-portal
[6921109.097325] [30442]  2335 30442    75573        0      37      689             0 ibus-engine-sim
[6921109.097327] [30449]  2335 30449   228685        0     175     2093             0 evolution-calen
[6921109.097329] [30474]  2335 30474   299671        0     175     2161             0 evolution-calen
[6921109.097331] [30492]  2335 30492   225366        0     167     2069             0 evolution-addre
[6921109.097333] [30513]  2335 30513   295924        0     174     1145             0 evolution-addre
[6921109.097335] [30582]  2335 30582    79463        0      42      171             0 gvfsd-metadata
[6921109.097337] [30920]  2335 30920   203650        0     141     3128             0 gnome-terminal-
[6921109.097339] [30928]  2335 30928     1709        0       9       27             0 gnome-pty-helpe
[6921109.097341] [30929]  2335 30929    28836        0      13      522             0 bash
[6921109.097342] [25214]  3528 25214    14106        0      32      144             0 dbus-daemon
[6921109.097344] [25244]  3528 25244    86755        0      37      691             0 at-spi-bus-laun
[6921109.097346] [25256]  3528 25256    46888        0      28      173             0 dconf-service
[6921109.097348] [25260]  3528 25260    14077        1      31      108             0 dbus-daemon
[6921109.097349] [25295]  3528 25295    97157        0      43      719             0 gvfsd
[6921109.097351] [25300]  3528 25300   104455        0      38      203             0 gvfsd-fuse
[6921109.097353] [25309]  3528 25309   175296        0      57      832             0 xdg-desktop-por
[6921109.097355] [25317]  3528 25317    91176        0      30      130             0 xdg-permission-
[6921109.097357] [ 7869]  3528  7869    14104        2      30      142             0 dbus-daemon
[6921109.097358] [ 7892]  3528  7892    86755        0      40      179             0 at-spi-bus-laun
[6921109.097360] [ 7905]  3528  7905    14077        1      31      109             0 dbus-daemon
[6921109.097362] [ 7941]  3528  7941    97157        0      43      208             0 gvfsd
[6921109.097364] [ 7952]  3528  7952   175296        0      60      327             0 xdg-desktop-por
[6921109.097366] [ 7961]  3528  7961    91176        0      30      129             0 xdg-permission-
[6921109.097368] [10142]  3528 10142    79355        0      38      761             0 gnome-keyring-d
[6921109.097370] [31445]  3528 31445    14103        2      31      140             0 dbus-daemon
[6921109.097372] [31462]  3528 31462    86755        0      37      690             0 at-spi-bus-laun
[6921109.097374] [31475]  3528 31475    14077        1      32      112             0 dbus-daemon
[6921109.097376] [31511]  3528 31511    97157        0      45     1229             0 gvfsd
[6921109.097378] [31520]  3528 31520   138430        0      56      315             0 xdg-desktop-por
[6921109.097380] [31529]  3528 31529    91176        0      31      128             0 xdg-permission-
[6921109.097382] [13701]  3528 13701    14110        0      30      132             0 dbus-daemon
[6921109.097384] [13760]  3528 13760    97157        0      43      208             0 gvfsd
[6921109.097386] [13770]  3528 13770   138430        0      52      315             0 xdg-desktop-por
[6921109.097388] [13778]  3528 13778    91176        0      30      129             0 xdg-permission-
[6921109.097390] [ 1892]  3528  1892    14162        2      29      184             0 dbus-daemon
[6921109.097392] [ 1941]  3528  1941    86755        0      36      179             0 at-spi-bus-laun
[6921109.097394] [ 1959]  3528  1959    14077        1      33      108             0 dbus-daemon
[6921109.097395] [ 1997]  3528  1997    97157        0      42      215             0 gvfsd
[6921109.097397] [ 2008]  3528  2008   138430        0      55      323             0 xdg-desktop-por
[6921109.097399] [ 2019]  3528  2019    91176        0      33      128             0 xdg-permission-
[6921109.097400] [ 3402]  3528  3402   104735     1033      55      566             0 gvfs-udisks2-vo
[6921109.097403] [ 3407]  3528  3407    92889        0      36      168             0 gvfs-goa-volume
[6921109.097405] [ 3411]  3528  3411   223364        0     164     1584             0 goa-daemon
[6921109.097406] [ 3418]  3528  3418   133615       35     106      531             0 goa-identity-se
[6921109.097408] [ 3425]  3528  3425   102909      118      69      303             0 mission-control
[6921109.097410] [ 3428]  3528  3428   119631        0      52      266             0 gvfs-afc-volume
[6921109.097412] [ 3437]  3528  3437   100173        0      48      218             0 gvfs-gphoto2-vo
[6921109.097414] [ 3442]  3528  3442    97900        0      43      185             0 gvfs-mtp-volume
[6921109.097416] [ 3447]  3528  3447   116223      116      46      186             0 gvfsd-trash
[6921109.097418] [ 3505]  3528  3505   117283        0      49      263             0 gvfsd-network
[6921109.097420] [ 3552]  3528  3552    46882        0      29      173             0 dconf-service
[6921109.097421] [ 3955]  3528  3955   123417       26      57      239             0 gvfsd-dnssd
[6921109.097423] [22048]  3528 22048    14110        1      29      136             0 dbus-daemon
[6921109.097425] [22091]  3528 22091    97157        0      41      206             0 gvfsd
[6921109.097427] [22101]  3528 22101   138430        0      54      318             0 xdg-desktop-por
[6921109.097429] [22109]  3528 22109    91176        0      31      129             0 xdg-permission-
[6921109.097431] [28110]  2335 28110   131313        0      60     1496             0 tracker-store
[6921109.097433] [12143]   478 12143   149286      618      87    15155             0 nxserver.bin
[6921109.097435] [10515]  3528 10515    14103        2      30      141             0 dbus-daemon
[6921109.097436] [10531]  3528 10531    86755        0      37      181             0 at-spi-bus-laun
[6921109.097439] [10543]  3528 10543    14077        1      32      108             0 dbus-daemon
[6921109.097440] [10587]  3528 10587    97157        0      41      206             0 gvfsd
[6921109.097442] [10596]  3528 10596   138430        0      56      315             0 xdg-desktop-por
[6921109.097444] [10604]  3528 10604    91176        0      31      128             0 xdg-permission-
[6921109.097446] [ 9913]  3528  9913    14169        2      30      188             0 dbus-daemon
[6921109.097448] [ 9950]  3528  9950    86755        0      37      178             0 at-spi-bus-laun
[6921109.097450] [ 9978]  3528  9978    14077        2      29      109             0 dbus-daemon
[6921109.097452] [10011]  3528 10011    97185        0      43      219             0 gvfsd
[6921109.097454] [10021]  3528 10021   156929        0      56      397             0 xdg-desktop-por
[6921109.097456] [10029]  3528 10029    91176        0      31      130             0 xdg-permission-
[6921109.097458] [ 5955]  3528  5955   104087      714      53      237             0 gvfs-udisks2-vo
[6921109.097460] [ 5966]  3528  5966    92889        0      34      151             0 gvfs-goa-volume
[6921109.097462] [ 5970]  3528  5970   223330        0     166     1549             0 goa-daemon
[6921109.097464] [ 5977]  3528  5977   131929        0     104      507             0 goa-identity-se
[6921109.097466] [ 5984]  3528  5984   121347      106      68      294             0 mission-control
[6921109.097467] [ 6209]  3528  6209   119629        0      52      265             0 gvfs-afc-volume
[6921109.097469] [ 6217]  3528  6217   100173        0      47      219             0 gvfs-gphoto2-vo
[6921109.097471] [ 6222]  3528  6222    97900        0      42      186             0 gvfs-mtp-volume
[6921109.097473] [ 6227]  3528  6227   116223      117      46      185             0 gvfsd-trash
[6921109.097475] [ 6263]  3528  6263   117283        0      49      281             0 gvfsd-network
[6921109.097477] [ 6357]  3528  6357    46882        0      29      175             0 dconf-service
[6921109.097479] [ 6554]  3528  6554   123417       26      59      238             0 gvfsd-dnssd
[6921109.097481] [27322]  3528 27322    14103        0      31      138             0 dbus-daemon
[6921109.097483] [27354]  3528 27354    86755        0      36      181             0 at-spi-bus-laun
[6921109.097484] [27366]  3528 27366    14077        1      32      109             0 dbus-daemon
[6921109.097487] [27400]  3528 27400    97157        0      42      207             0 gvfsd
[6921109.097488] [27410]  3528 27410   175296        0      56      321             0 xdg-desktop-por
[6921109.097490] [27418]  3528 27418    91176        0      31      130             0 xdg-permission-
[6921109.097492] [16244]     0 16244   299446     2599     117     6576          -500 dockerd
[6921109.097494] [24330]     0 24330    39912        0      80      337             0 sshd
[6921109.097496] [24334]  2058 24334    39912        1      76      344             0 sshd
[6921109.097498] [24340]  2058 24340    29780        2      14      389             0 tcsh
[6921109.097500] [21131]  3528 21131    14103        2      31      140             0 dbus-daemon
[6921109.097502] [21165]  3528 21165    86755        0      38      180             0 at-spi-bus-laun
[6921109.097504] [21178]  3528 21178    14077        1      34      108             0 dbus-daemon
[6921109.097506] [21220]  3528 21220    97157        0      42      207             0 gvfsd
[6921109.097508] [21229]  3528 21229   158912        0      57      327             0 xdg-desktop-por
[6921109.097509] [21238]  3528 21238    91176        0      30      128             0 xdg-permission-
[6921109.097511] [17191]  3528 17191     2986        2      11       35             0 git-credential-
[6921109.097513] [ 2692]     0  2692    42091       49      86      330             0 sshd
[6921109.097515] [ 2726]     0  2726    42092        2      86      380             0 sshd
[6921109.097517] [ 2729]  3528  2729    42685      247      85      811             0 sshd
[6921109.097518] [ 2871]  3528  2871    28869        1      13      550             0 bash
[6921109.097520] [ 2922]  3528  2922    42092        0      83      387             0 sshd
[6921109.097522] [ 3023]  3528  3023    17638        0      39      202             0 sftp-server
[6921109.097524] [ 3127]  3528  3127    14103       32      32      109             0 dbus-daemon
[6921109.097526] [ 3154]  3528  3154    86755        0      38      184             0 at-spi-bus-laun
[6921109.097528] [ 3167]  3528  3167    14077       27      30       83             0 dbus-daemon
[6921109.097529] [ 3177]  3528  3177    58332       32      48      166             0 at-spi2-registr
[6921109.097531] [ 3181]  3528  3181   175835     1728     127     1895             0 gnome-terminal-
[6921109.097533] [ 3219]  3528  3219    97157        0      43      216             0 gvfsd
[6921109.097535] [ 3229]  3528  3229   175296        0      57      355             0 xdg-desktop-por
[6921109.097537] [ 3237]  3528  3237    91176        0      31      128             0 xdg-permission-
[6921109.097539] [ 3243]  3528  3243   143955        0      92      690             0 xdg-desktop-por
[6921109.097540] [ 3253]  3528  3253     1710        0       9       43             0 gnome-pty-helpe
[6921109.097542] [ 3254]  3528  3254    28464        2      11      150             0 bash
[6921109.097543] [ 3376]  3528  3376    28322        0      11       72             0 blueskyJemian.s
[6921109.097545] [ 3386]  3528  3386  5847100  3638468   10355  1540415             0 ipython
[6921109.097547] [29885]  3528 29885  1245452     3656     244     5321             0 code
[6921109.097549] [29892]  3528 29892   113340        7     144     1787             0 code
[6921109.097551] [29893]  3528 29893   113340        0     144     1787             0 code
[6921109.097553] [30068]  3528 30068   133618      905     169     3301             0 code
[6921109.097555] [30131]  3528 30131  3885547     9182     383    23368             0 code
[6921109.097556] [30226]  3528 30226   131920     1592     166     4568           200 code
[6921109.097558] [30277]  3528 30277  1222156     5021     234     3420             0 code
[6921109.097560] [30553]  3528 30553  1187977     4122     238    17699             0 code
[6921109.097570] [30591]  3528 30591  1159092      181     160     4540             0 code
[6921109.097573] [30932]  3528 30932    97964        0      44    10454             0 python
[6921109.097575] [30960]  3528 30960    35337        1      25     3789             0 python
[6921109.097577] [31013]  3528 31013  1154630      402     179     9481             0 code
[6921109.097579] [11612]  3528 11612    35337        0      26     3763             0 python
[6921109.097581] [26012]  3528 26012    28472        1      11      139             0 bash
[6921109.097583] [32653]  3528 32653    35337        1      24     3765             0 python
[6921109.097585] [10527]  3528 10527    28442        2      11      143             0 bash
[6921109.097586] [10993]  3528 10993   453459      912     250    51802             0 ipython
[6921109.097589] [18597]  3528 18597    27025       11      10       17             0 tail
[6921109.097590] [18598]  3528 18598    28205       32      10       12             0 grep
[6921109.097592] [ 1926]    89  1926    22079      243      43       10             0 pickup
[6921109.097596] [23255]     0 23255    27014       19       8        0             0 sleep
[6921109.097598] [23697]  2335 23697    27014       50       9        0             0 sleep
[6921109.097599] Out of memory: Kill process 3386 (ipython) score 858 or sacrifice child
[6921109.097604] Killed process 3386 (ipython), UID 3528, total-vm:23388400kB, anon-rss:14551000kB, file-rss:2872kB, shmem-rss:0kB
(base) jemian@wow /var/log $ 

@prjemian
Copy link
Owner Author

System has 16 GB of RAM, 6 of which are free at this time

(base) jemian@wow /var/log $ top

top - 09:00:12 up 80 days,  7:47,  6 users,  load average: 0.07, 0.07, 0.05
Tasks: 468 total,   1 running, 467 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.5 us,  0.2 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 16041864 total, 14054160 free,  1126516 used,   861188 buff/cache
KiB Swap:  8126460 total,  6243064 free,  1883396 used. 14553208 avail Mem 

@prjemian
Copy link
Owner Author

Also note that 00:57 this morning, the run paused for about 9 minutes and resumed with no logs or other info shown to the ipython console. Anything in the system logs? Most of those are read-only by root.

@prjemian
Copy link
Owner Author

Need to add memory diagnostics before repeating that same test. No observation of the problems we were expecting to find!

@prjemian
Copy link
Owner Author

Getting the total number of bytes used by any python object is a complex task and is not generally supported. The object().__sizeof__() method can be overwritten in subclasses but usually is not. Easier, for now to report the amount of memory in use by the ipython session, as identified by its PID. This command returns a dictionary:

import os
import psutil

def rss_mem():
    return psutil.Process(os.getpid()).memory_info()

See https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_info for what these terms mean.

Here is the value at the start of a bluesky session:

In [138]: rss_mem()                                                                                                                                   
Out[138]: pmem(rss=329719808, vms=2142060544, shared=77783040, text=2506752, lib=0, data=1731530752, dirty=0)

rss: aka “Resident Set Size”, this is the non-swapped physical memory a process has used. On UNIX it matches “top“‘s RES column).


references:

@prjemian
Copy link
Owner Author

MB in use:

In [144]: rss_mem().rss/1024./1024                                                                                                                    
Out[144]: 314.4453125

@prjemian
Copy link
Owner Author

Track rss_mem().rss at each iteration.

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Definitely leaking memory somewhere:

(base) jemian@wow ~ $ tail -f /tmp/.logs/ipython_logger.log | grep Finished
|2020-11-01 00:52:07.576|INFO|18281|bluesky-session|example|121|bluesky-run-engine| - Finished #1 of 1000 iterations, dt=31.953 s, memory_change=39911424
|2020-11-01 00:52:38.930|INFO|18281|bluesky-session|example|121|bluesky-run-engine| - Finished #2 of 1000 iterations, dt=31.354 s, memory_change=7999488
|2020-11-01 00:53:10.996|INFO|18281|bluesky-session|example|121|bluesky-run-engine| - Finished #3 of 1000 iterations, dt=32.065 s, memory_change=7327744
|2020-11-01 00:53:43.633|INFO|18281|bluesky-session|example|121|bluesky-run-engine| - Finished #4 of 1000 iterations, dt=32.637 s, memory_change=8499200
|2020-11-01 00:54:15.380|INFO|18281|bluesky-session|example|121|bluesky-run-engine| - Finished #5 of 1000 iterations, dt=31.746 s, memory_change=6950912
|2020-11-01 00:54:47.341|INFO|18281|bluesky-session|example|121|bluesky-run-engine| - Finished #6 of 1000 iterations, dt=31.958 s, memory_change=8507392

again

(base) jemian@wow ~ $ tail -f /tmp/.logs/ipython_logger.log | grep Finished
|2020-11-01 00:56:24.774|INFO|23841|bluesky-session|example|126|bluesky-run-engine| - Finished #1 of 1000 iterations, dt=31.880 s, memory_change=37117952
|2020-11-01 00:56:57.525|INFO|23841|bluesky-session|example|126|bluesky-run-engine| - Finished #2 of 1000 iterations, dt=32.751 s, memory_change=11739136
|2020-11-01 00:57:29.175|INFO|23841|bluesky-session|example|126|bluesky-run-engine| - Finished #3 of 1000 iterations, dt=31.650 s, memory_change=7311360
|2020-11-01 00:58:00.927|INFO|23841|bluesky-session|example|126|bluesky-run-engine| - Finished #4 of 1000 iterations, dt=31.752 s, memory_change=7401472
|2020-11-01 00:58:32.977|INFO|23841|bluesky-session|example|126|bluesky-run-engine| - Finished #5 of 1000 iterations, dt=32.050 s, memory_change=7602176
|2020-11-01 00:59:04.632|INFO|23841|bluesky-session|example|126|bluesky-run-engine| - Finished #6 of 1000 iterations, dt=31.655 s, memory_change=8536064

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Disable specwriter and re-measure. Cuts the leak rate in (about) half. Keep looking...

(base) jemian@wow ~ $ tail -f /tmp/.logs/ipython_logger.log | grep Finished
|2020-11-01 01:01:20.457|INFO|30563|bluesky-session|example|126|bluesky-run-engine| - Finished #1 of 1000 iterations, dt=31.228 s, memory_change=37380096
|2020-11-01 01:01:52.190|INFO|30563|bluesky-session|example|126|bluesky-run-engine| - Finished #2 of 1000 iterations, dt=31.733 s, memory_change=4288512
|2020-11-01 01:02:24.340|INFO|30563|bluesky-session|example|126|bluesky-run-engine| - Finished #3 of 1000 iterations, dt=32.149 s, memory_change=3194880
|2020-11-01 01:02:56.395|INFO|30563|bluesky-session|example|126|bluesky-run-engine| - Finished #4 of 1000 iterations, dt=32.054 s, memory_change=4554752
|2020-11-01 01:03:27.840|INFO|30563|bluesky-session|example|126|bluesky-run-engine| - Finished #5 of 1000 iterations, dt=31.444 s, memory_change=3121152
|2020-11-01 01:03:59.390|INFO|30563|bluesky-session|example|126|bluesky-run-engine| - Finished #6 of 1000 iterations, dt=31.550 s, memory_change=5390336

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Run 1000 iterations, project to use about 4GB of RAM. (~4 MB/iteration)

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

BTW, this measurement will span the summer (CDT) to winter (CST) time change.

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Next, evaluate the memory leak rate using a bare RunEngine and no bec and minimal RE.md additions.

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

bare example

code: bp.count()
#!/usr/bin/env python

"""
issue3_test.py

https://github.com/prjemian/ipython-aps/issues/3#issuecomment-720042520
"""

import os
import psutil
import sys
import time

from bluesky import RunEngine
from bluesky import plans as bp
from ophyd.sim import motor, noisy_det

RE = RunEngine({})
pid = os.getpid()
process = psutil.Process(pid)


def rss_mem():
    """return memory used by this process"""
    return process.memory_info()


def example(iters=1):
    mem_start = rss_mem().rss
    for _i in range(iters):
        t0 = time.time()
        mem0 = rss_mem().rss
        yield from bp.count([noisy_det])
        # yield from bp.scan([noisy_det], motor, -2.1, 2.1, 23)
        mem = rss_mem().rss
        print(
            f"Finished #{_i+1} of {iters} iterations"
            f", dt={time.time() - t0:.3f} s"
            f", bytes={mem}, bytes_changed={mem - mem0}"
            )
    mem_end = rss_mem().rss
    print(f"changed: {mem_end - mem_start}")


uids = RE(example(25))
console output
(bluesky_2020_9) jemian@wow ~ $ ./issue3_test.py 
Finished #1 of 25 iterations, dt=0.003 s, bytes=87867392, bytes_changed=90112
Finished #2 of 25 iterations, dt=0.002 s, bytes=87871488, bytes_changed=4096
Finished #3 of 25 iterations, dt=0.002 s, bytes=87871488, bytes_changed=0
Finished #4 of 25 iterations, dt=0.002 s, bytes=87871488, bytes_changed=0
Finished #5 of 25 iterations, dt=0.002 s, bytes=87871488, bytes_changed=0
Finished #6 of 25 iterations, dt=0.002 s, bytes=87875584, bytes_changed=4096
Finished #7 of 25 iterations, dt=0.002 s, bytes=87875584, bytes_changed=0
Finished #8 of 25 iterations, dt=0.002 s, bytes=87875584, bytes_changed=0
Finished #9 of 25 iterations, dt=0.003 s, bytes=87875584, bytes_changed=0
Finished #10 of 25 iterations, dt=0.003 s, bytes=87879680, bytes_changed=4096
Finished #11 of 25 iterations, dt=0.003 s, bytes=88080384, bytes_changed=200704
Finished #12 of 25 iterations, dt=0.003 s, bytes=88080384, bytes_changed=0
Finished #13 of 25 iterations, dt=0.003 s, bytes=88084480, bytes_changed=4096
Finished #14 of 25 iterations, dt=0.002 s, bytes=88084480, bytes_changed=0
Finished #15 of 25 iterations, dt=0.002 s, bytes=88084480, bytes_changed=0
Finished #16 of 25 iterations, dt=0.002 s, bytes=88088576, bytes_changed=4096
Finished #17 of 25 iterations, dt=0.002 s, bytes=88088576, bytes_changed=0
Finished #18 of 25 iterations, dt=0.002 s, bytes=88088576, bytes_changed=0
Finished #19 of 25 iterations, dt=0.002 s, bytes=88088576, bytes_changed=0
Finished #20 of 25 iterations, dt=0.002 s, bytes=88092672, bytes_changed=4096
Finished #21 of 25 iterations, dt=0.002 s, bytes=88092672, bytes_changed=0
Finished #22 of 25 iterations, dt=0.002 s, bytes=88092672, bytes_changed=0
Finished #23 of 25 iterations, dt=0.002 s, bytes=88096768, bytes_changed=4096
Finished #24 of 25 iterations, dt=0.002 s, bytes=88096768, bytes_changed=0
Finished #25 of 25 iterations, dt=0.002 s, bytes=88096768, bytes_changed=0
changed: 319488
code: bp.scan()
#!/usr/bin/env python

"""
issue3_test.py

https://github.com/prjemian/ipython-aps/issues/3#issuecomment-720042520
"""

import os
import psutil
import sys
import time

from bluesky import RunEngine
from bluesky import plans as bp
from ophyd.sim import motor, noisy_det

RE = RunEngine({})
pid = os.getpid()
process = psutil.Process(pid)


def rss_mem():
    """return memory used by this process"""
    return process.memory_info()


def example(iters=1):
    mem_start = rss_mem().rss
    for _i in range(iters):
        t0 = time.time()
        mem0 = rss_mem().rss
        # yield from bp.count([noisy_det])
        yield from bp.scan([noisy_det], motor, -2.1, 2.1, 23)
        mem = rss_mem().rss
        print(
            f"Finished #{_i+1} of {iters} iterations"
            f", dt={time.time() - t0:.3f} s"
            f", bytes={mem}, bytes_changed={mem - mem0}"
            )
    mem_end = rss_mem().rss
    print(f"changed: {mem_end - mem_start}")


uids = RE(example(25))
console output
(bluesky_2020_9) jemian@wow ~ $ ./issue3_test.py 
Finished #1 of 25 iterations, dt=0.026 s, bytes=88453120, bytes_changed=630784
Finished #2 of 25 iterations, dt=0.025 s, bytes=89055232, bytes_changed=602112
Finished #3 of 25 iterations, dt=0.025 s, bytes=89690112, bytes_changed=634880
Finished #4 of 25 iterations, dt=0.025 s, bytes=90415104, bytes_changed=724992
Finished #5 of 25 iterations, dt=0.025 s, bytes=90800128, bytes_changed=385024
Finished #6 of 25 iterations, dt=0.025 s, bytes=91455488, bytes_changed=655360
Finished #7 of 25 iterations, dt=0.025 s, bytes=92094464, bytes_changed=638976
Finished #8 of 25 iterations, dt=0.025 s, bytes=92729344, bytes_changed=634880
Finished #9 of 25 iterations, dt=0.025 s, bytes=93114368, bytes_changed=385024
Finished #10 of 25 iterations, dt=0.025 s, bytes=93777920, bytes_changed=663552
Finished #11 of 25 iterations, dt=0.025 s, bytes=94420992, bytes_changed=643072
Finished #12 of 25 iterations, dt=0.025 s, bytes=95047680, bytes_changed=626688
Finished #13 of 25 iterations, dt=0.025 s, bytes=95588352, bytes_changed=540672
Finished #14 of 25 iterations, dt=0.025 s, bytes=96219136, bytes_changed=630784
Finished #15 of 25 iterations, dt=0.025 s, bytes=96563200, bytes_changed=344064
Finished #16 of 25 iterations, dt=0.025 s, bytes=97202176, bytes_changed=638976
Finished #17 of 25 iterations, dt=0.025 s, bytes=97787904, bytes_changed=585728
Finished #18 of 25 iterations, dt=0.025 s, bytes=98406400, bytes_changed=618496
Finished #19 of 25 iterations, dt=0.025 s, bytes=98893824, bytes_changed=487424
Finished #20 of 25 iterations, dt=0.024 s, bytes=99528704, bytes_changed=634880
Finished #21 of 25 iterations, dt=0.025 s, bytes=100233216, bytes_changed=704512
Finished #22 of 25 iterations, dt=0.025 s, bytes=100593664, bytes_changed=360448
Finished #23 of 25 iterations, dt=0.025 s, bytes=101216256, bytes_changed=622592
Finished #24 of 25 iterations, dt=0.025 s, bytes=101969920, bytes_changed=753664
Finished #25 of 25 iterations, dt=0.025 s, bytes=102342656, bytes_changed=372736
changed: 14520320

versions:

(bluesky_2020_9) jemian@wow ~ $ conda list bluesky
# packages in environment at /home/beams/JEMIAN/.conda/envs/bluesky_2020_9:
#
# Name                    Version                   Build  Channel
bluesky                   1.6.6                      py_0    conda-forge
(bluesky_2020_9) jemian@wow ~ $ conda list ophyd
# packages in environment at /home/beams/JEMIAN/.conda/envs/bluesky_2020_9:
#
# Name                    Version                   Build  Channel
ophyd                     1.5.3.post34+g599d562           dev_0    <develop>

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Create a new, clean environment for testing:

conda create -n bstest bluesky ophyd psutil -c conda-forge

Includes:

  • bluesky conda-forge/noarch::bluesky-1.6.6-py_0
  • ophyd conda-forge/noarch::ophyd-1.5.4-py_0
  • psutil conda-forge/linux-64::psutil-5.7.3-py37hb5d75c8_0

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Same code as above:

output: bp.count()
(bstest) jemian@wow ~ $ ./issue3_test.py 
Finished #1 of 25 iterations, dt=0.003 s, bytes=74743808, bytes_changed=0
Finished #2 of 25 iterations, dt=0.002 s, bytes=75014144, bytes_changed=270336
Finished #3 of 25 iterations, dt=0.002 s, bytes=75014144, bytes_changed=0
Finished #4 of 25 iterations, dt=0.002 s, bytes=75014144, bytes_changed=0
Finished #5 of 25 iterations, dt=0.002 s, bytes=75014144, bytes_changed=0
Finished #6 of 25 iterations, dt=0.002 s, bytes=75018240, bytes_changed=4096
Finished #7 of 25 iterations, dt=0.002 s, bytes=75018240, bytes_changed=0
Finished #8 of 25 iterations, dt=0.002 s, bytes=75018240, bytes_changed=0
Finished #9 of 25 iterations, dt=0.002 s, bytes=75022336, bytes_changed=4096
Finished #10 of 25 iterations, dt=0.002 s, bytes=75022336, bytes_changed=0
Finished #11 of 25 iterations, dt=0.002 s, bytes=75022336, bytes_changed=0
Finished #12 of 25 iterations, dt=0.002 s, bytes=75026432, bytes_changed=4096
Finished #13 of 25 iterations, dt=0.002 s, bytes=75026432, bytes_changed=0
Finished #14 of 25 iterations, dt=0.002 s, bytes=75026432, bytes_changed=0
Finished #15 of 25 iterations, dt=0.002 s, bytes=75026432, bytes_changed=0
Finished #16 of 25 iterations, dt=0.002 s, bytes=75030528, bytes_changed=4096
Finished #17 of 25 iterations, dt=0.002 s, bytes=75030528, bytes_changed=0
Finished #18 of 25 iterations, dt=0.002 s, bytes=75030528, bytes_changed=0
Finished #19 of 25 iterations, dt=0.002 s, bytes=75030528, bytes_changed=0
Finished #20 of 25 iterations, dt=0.002 s, bytes=75034624, bytes_changed=4096
Finished #21 of 25 iterations, dt=0.002 s, bytes=75034624, bytes_changed=0
Finished #22 of 25 iterations, dt=0.002 s, bytes=75034624, bytes_changed=0
Finished #23 of 25 iterations, dt=0.002 s, bytes=75042816, bytes_changed=8192
Finished #24 of 25 iterations, dt=0.002 s, bytes=75042816, bytes_changed=0
Finished #25 of 25 iterations, dt=0.002 s, bytes=75042816, bytes_changed=0
changed: 299008
output: bp.scan()
(bluesky_2020_9) jemian@wow ~ $  conda activate bstest
(bstest) jemian@wow ~ $ ./issue3_test.py 
Finished #1 of 25 iterations, dt=0.027 s, bytes=75513856, bytes_changed=761856
Finished #2 of 25 iterations, dt=0.026 s, bytes=76238848, bytes_changed=724992
Finished #3 of 25 iterations, dt=0.026 s, bytes=76607488, bytes_changed=368640
Finished #4 of 25 iterations, dt=0.025 s, bytes=77262848, bytes_changed=655360
Finished #5 of 25 iterations, dt=0.026 s, bytes=77709312, bytes_changed=446464
Finished #6 of 25 iterations, dt=0.025 s, bytes=78360576, bytes_changed=651264
Finished #7 of 25 iterations, dt=0.026 s, bytes=79044608, bytes_changed=684032
Finished #8 of 25 iterations, dt=0.026 s, bytes=79532032, bytes_changed=487424
Finished #9 of 25 iterations, dt=0.026 s, bytes=80179200, bytes_changed=647168
Finished #10 of 25 iterations, dt=0.025 s, bytes=80830464, bytes_changed=651264
Finished #11 of 25 iterations, dt=0.026 s, bytes=81403904, bytes_changed=573440
Finished #12 of 25 iterations, dt=0.025 s, bytes=81768448, bytes_changed=364544
Finished #13 of 25 iterations, dt=0.025 s, bytes=82432000, bytes_changed=663552
Finished #14 of 25 iterations, dt=0.026 s, bytes=83120128, bytes_changed=688128
Finished #15 of 25 iterations, dt=0.026 s, bytes=83496960, bytes_changed=376832
Finished #16 of 25 iterations, dt=0.026 s, bytes=84156416, bytes_changed=659456
Finished #17 of 25 iterations, dt=0.026 s, bytes=84680704, bytes_changed=524288
Finished #18 of 25 iterations, dt=0.025 s, bytes=85327872, bytes_changed=647168
Finished #19 of 25 iterations, dt=0.025 s, bytes=86024192, bytes_changed=696320
Finished #20 of 25 iterations, dt=0.026 s, bytes=86499328, bytes_changed=475136
Finished #21 of 25 iterations, dt=0.025 s, bytes=87142400, bytes_changed=643072
Finished #22 of 25 iterations, dt=0.025 s, bytes=87531520, bytes_changed=389120
Finished #23 of 25 iterations, dt=0.027 s, bytes=88215552, bytes_changed=684032
Finished #24 of 25 iterations, dt=0.026 s, bytes=88825856, bytes_changed=610304
Finished #25 of 25 iterations, dt=0.026 s, bytes=89309184, bytes_changed=483328
changed: 14557184

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Observations:

  1. rss memory is consumed and not recovered when running a bluesky plan
  2. Change in rss memory is comparable (statistically identical) between compared versions of bluesky & ophyd.
  3. bp.count consumes less rss memory per run than bp.scan
  4. Amount of memory consumed is not uniform, has wide variation

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Chart showing memory consumed for 137 iterations of bp.scan, per above:

Clipboard01

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Use tracemalloc to investigate further per https://medium.com/survata-engineering-blog/monitoring-memory-usage-of-a-running-python-program-49f027e3d1ba#9794

import tracemalloc

tracemalloc.start()
my_complex_analysis_method()
current, peak = tracemalloc.get_traced_memory()
print(f"Current memory usage is {current / 10**6}MB; Peak was {peak / 10**6}MB")
tracemalloc.stop()

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Show differences across execution of a function:

snapshot1 = tracemalloc.take_snapshot()
# ... call the function leaking memory ...
snapshot2 = tracemalloc.take_snapshot()

top_stats = snapshot2.compare_to(snapshot1, 'lineno')

print("[ Top 10 differences ]")
for stat in top_stats[:10]:
    print(stat)

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

Re-run the issue3_test.py code using bp.scan(...) since it shows the most memory consumption. Identify the items with more than 10,000 bytes size change as found by tracemalloc.

Finished #1 of 5 iterations, dt=0.037 s, bytes=76124160, bytes_changed=1257472
tracemalloc lineno differences > 10000 bytes:
==== ===== ========================================================================================================================================================
item diff  value                                                                                                                                                   
==== ===== ========================================================================================================================================================
1    82320 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:238: size=80.4 KiB (+80.4 KiB), count=319 (+319), average=258 B                        
2    63871 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/abc.py:143: size=62.4 KiB (+62.4 KiB), count=515 (+515), average=124 B                              
3    43104 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:90: size=42.1 KiB (+42.1 KiB), count=136 (+136), average=317 B        
4    42112 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:500: size=41.1 KiB (+41.1 KiB), count=899 (+899), average=47 B                         
5    39744 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:804: size=38.8 KiB (+38.8 KiB), count=69 (+69), average=576 B                          
6    35904 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:365: size=35.1 KiB (+35.1 KiB), count=68 (+68), average=528 B                          
7    34848 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:348: size=34.0 KiB (+34.0 KiB), count=66 (+66), average=528 B                          
8    21280 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/jsonschema/validators.py:344: size=20.8 KiB (+20.8 KiB), count=38 (+38), average=560 B
9    14240 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/signal.py:389: size=13.9 KiB (+13.9 KiB), count=111 (+111), average=128 B       
10   12448 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:93: size=12.2 KiB (+12.2 KiB), count=165 (+165), average=75 B         
11   11728 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:2095: size=11.5 KiB (+11.5 KiB), count=23 (+23), average=510 B  
12   11592 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:601: size=11.3 KiB (+11.3 KiB), count=69 (+69), average=168 B         
13   11392 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/ophydobj.py:383: size=11.1 KiB (+11.1 KiB), count=116 (+116), average=98 B      
14   10880 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:849: size=10.6 KiB (+10.6 KiB), count=136 (+136), average=80 B                         
15   10880 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:222: size=10.6 KiB (+10.6 KiB), count=136 (+136), average=80 B                         
16   10800 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:221: size=10.5 KiB (+10.5 KiB), count=135 (+135), average=80 B                         
17   10488 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/locks.py:244: size=10.2 KiB (+10.2 KiB), count=138 (+138), average=76 B                     
18   10424 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/_weakrefset.py:84: size=10.2 KiB (+10.2 KiB), count=71 (+71), average=147 B                         
==== ===== ========================================================================================================================================================

Finished #2 of 5 iterations, dt=0.038 s, bytes=78663680, bytes_changed=1191936
tracemalloc lineno differences > 10000 bytes:
==== ===== ========================================================================================================================================================
item diff  value                                                                                                                                                   
==== ===== ========================================================================================================================================================
1    82320 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:238: size=161 KiB (+80.4 KiB), count=638 (+319), average=258 B                         
2    43104 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:90: size=84.2 KiB (+42.1 KiB), count=272 (+136), average=317 B        
3    41712 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:500: size=81.9 KiB (+40.7 KiB), count=1793 (+894), average=47 B                        
4    39744 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:804: size=77.6 KiB (+38.8 KiB), count=138 (+69), average=576 B                         
5    35904 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:365: size=70.1 KiB (+35.1 KiB), count=136 (+68), average=528 B                         
6    34320 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:348: size=67.5 KiB (+33.5 KiB), count=131 (+65), average=528 B                         
7    15680 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/jsonschema/validators.py:344: size=35.5 KiB (+15.3 KiB), count=65 (+28), average=560 B
8    12600 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/signal.py:389: size=26.2 KiB (+12.3 KiB), count=208 (+97), average=129 B        
9    11592 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:601: size=22.6 KiB (+11.3 KiB), count=138 (+69), average=168 B        
10   11456 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:93: size=23.3 KiB (+11.2 KiB), count=322 (+157), average=74 B         
11   11088 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:2095: size=22.3 KiB (+10.8 KiB), count=44 (+21), average=519 B  
12   10976 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/ophydobj.py:383: size=21.8 KiB (+10.7 KiB), count=229 (+113), average=98 B      
13   10720 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:849: size=21.1 KiB (+10.5 KiB), count=270 (+134), average=80 B                         
14   10640 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:222: size=21.0 KiB (+10.4 KiB), count=269 (+133), average=80 B                         
15   10640 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:221: size=20.9 KiB (+10.4 KiB), count=268 (+133), average=80 B                         
16   10488 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/locks.py:244: size=20.5 KiB (+10.2 KiB), count=276 (+138), average=76 B                     
==== ===== ========================================================================================================================================================

Finished #3 of 5 iterations, dt=0.041 s, bytes=82104320, bytes_changed=1277952
tracemalloc lineno differences > 10000 bytes:
==== ===== ======================================================================================================================================================
item diff  value                                                                                                                                                 
==== ===== ======================================================================================================================================================
1    83904 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:238: size=243 KiB (+81.9 KiB), count=960 (+322), average=259 B                       
2    44160 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:90: size=127 KiB (+43.1 KiB), count=410 (+138), average=318 B       
3    41552 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:500: size=122 KiB (+40.6 KiB), count=2685 (+892), average=47 B                       
4    39744 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:804: size=116 KiB (+38.8 KiB), count=207 (+69), average=576 B                        
5    36432 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:365: size=106 KiB (+35.6 KiB), count=205 (+69), average=528 B                        
6    34320 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:348: size=101 KiB (+33.5 KiB), count=196 (+65), average=528 B                        
7    18360 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/_weakrefset.py:84: size=34.0 KiB (+17.9 KiB), count=209 (+69), average=167 B                      
8    13184 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/signal.py:389: size=39.1 KiB (+12.9 KiB), count=309 (+101), average=130 B     
9    12144 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:2095: size=34.1 KiB (+11.9 KiB), count=67 (+23), average=522 B
10   11592 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:601: size=34.0 KiB (+11.3 KiB), count=207 (+69), average=168 B      
11   11296 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:93: size=34.4 KiB (+11.0 KiB), count=477 (+155), average=74 B       
12   11144 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/ophydobj.py:383: size=32.7 KiB (+10.9 KiB), count=343 (+114), average=98 B    
13   11040 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:849: size=31.9 KiB (+10.8 KiB), count=408 (+138), average=80 B                       
14   10960 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:222: size=31.7 KiB (+10.7 KiB), count=406 (+137), average=80 B                       
15   10960 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:221: size=31.6 KiB (+10.7 KiB), count=405 (+137), average=80 B                       
16   10488 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/locks.py:244: size=30.7 KiB (+10.2 KiB), count=414 (+138), average=76 B                   
==== ===== ======================================================================================================================================================

Finished #4 of 5 iterations, dt=0.046 s, bytes=84643840, bytes_changed=651264
tracemalloc lineno differences > 10000 bytes:
==== ===== ======================================================================================================================================================
item diff  value                                                                                                                                                 
==== ===== ======================================================================================================================================================
1    83904 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:238: size=325 KiB (+81.9 KiB), count=1282 (+322), average=259 B                      
2    44160 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:90: size=170 KiB (+43.1 KiB), count=548 (+138), average=318 B       
3    41632 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:500: size=163 KiB (+40.7 KiB), count=3578 (+893), average=47 B                       
4    39744 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:804: size=155 KiB (+38.8 KiB), count=276 (+69), average=576 B                        
5    36432 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:365: size=141 KiB (+35.6 KiB), count=274 (+69), average=528 B                        
6    34320 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:348: size=135 KiB (+33.5 KiB), count=261 (+65), average=528 B                        
7    13512 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/signal.py:389: size=52.3 KiB (+13.2 KiB), count=413 (+104), average=130 B     
8    11616 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:2095: size=45.5 KiB (+11.3 KiB), count=89 (+22), average=523 B
9    11592 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:601: size=45.3 KiB (+11.3 KiB), count=276 (+69), average=168 B      
10   11296 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:93: size=45.4 KiB (+11.0 KiB), count=632 (+155), average=74 B       
11   11040 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:849: size=42.7 KiB (+10.8 KiB), count=546 (+138), average=80 B                       
12   10976 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/ophydobj.py:383: size=43.4 KiB (+10.7 KiB), count=456 (+113), average=98 B    
13   10960 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:222: size=42.4 KiB (+10.7 KiB), count=543 (+137), average=80 B                       
14   10960 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:221: size=42.3 KiB (+10.7 KiB), count=542 (+137), average=80 B                       
15   10488 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/locks.py:244: size=41.0 KiB (+10.2 KiB), count=552 (+138), average=76 B                   
==== ===== ======================================================================================================================================================

Finished #5 of 5 iterations, dt=0.046 s, bytes=87199744, bytes_changed=1183744
tracemalloc lineno differences > 10000 bytes:
==== ===== =======================================================================================================================================================
item diff  value                                                                                                                                                  
==== ===== =======================================================================================================================================================
1    83904 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:238: size=407 KiB (+81.9 KiB), count=1604 (+322), average=260 B                       
2    44160 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:90: size=214 KiB (+43.1 KiB), count=686 (+138), average=319 B        
3    41712 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:500: size=204 KiB (+40.7 KiB), count=4472 (+894), average=47 B                        
4    39744 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:804: size=194 KiB (+38.8 KiB), count=345 (+69), average=576 B                         
5    36432 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:365: size=177 KiB (+35.6 KiB), count=343 (+69), average=528 B                         
6    33264 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:348: size=167 KiB (+32.5 KiB), count=324 (+63), average=528 B                         
7    12264 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/signal.py:389: size=64.3 KiB (+12.0 KiB), count=508 (+95), average=130 B       
8    12144 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:2095: size=57.3 KiB (+11.9 KiB), count=112 (+23), average=524 B
9    11592 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:601: size=56.6 KiB (+11.3 KiB), count=345 (+69), average=168 B       
10   11376 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:93: size=56.5 KiB (+11.1 KiB), count=788 (+156), average=73 B        
11   11040 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:849: size=53.4 KiB (+10.8 KiB), count=684 (+138), average=80 B                        
12   10976 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/ophydobj.py:383: size=54.2 KiB (+10.7 KiB), count=569 (+113), average=97 B     
13   10960 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:222: size=53.1 KiB (+10.7 KiB), count=680 (+137), average=80 B                        
14   10960 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:221: size=53.0 KiB (+10.7 KiB), count=679 (+137), average=80 B                        
15   10488 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/locks.py:244: size=51.2 KiB (+10.2 KiB), count=690 (+138), average=76 B                    
==== ===== =======================================================================================================================================================

changed: 13385728
tracemalloc lineno differences > 10000 bytes:
==== ====== ========================================================================================================================================================
item diff   value                                                                                                                                                   
==== ====== ========================================================================================================================================================
1    416352 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:238: size=407 KiB (+407 KiB), count=1604 (+1604), average=260 B                        
2    218688 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:90: size=214 KiB (+214 KiB), count=686 (+686), average=319 B          
3    208720 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:500: size=204 KiB (+204 KiB), count=4472 (+4472), average=47 B                         
4    198720 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:804: size=194 KiB (+194 KiB), count=345 (+345), average=576 B                          
5    181104 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:365: size=177 KiB (+177 KiB), count=343 (+343), average=528 B                          
6    171072 /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:348: size=167 KiB (+167 KiB), count=324 (+324), average=528 B                          
7    65800  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/signal.py:389: size=64.3 KiB (+64.3 KiB), count=508 (+508), average=130 B       
8    63871  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/abc.py:143: size=62.4 KiB (+62.4 KiB), count=515 (+515), average=124 B                              
9    58720  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:2095: size=57.3 KiB (+57.3 KiB), count=112 (+112), average=524 B
10   57960  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:601: size=56.6 KiB (+56.6 KiB), count=345 (+345), average=168 B       
11   57872  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:93: size=56.5 KiB (+56.5 KiB), count=788 (+788), average=73 B         
12   55464  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/ophydobj.py:383: size=54.2 KiB (+54.2 KiB), count=569 (+569), average=97 B      
13   54720  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:849: size=53.4 KiB (+53.4 KiB), count=684 (+684), average=80 B                         
14   54400  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:222: size=53.1 KiB (+53.1 KiB), count=680 (+680), average=80 B                         
15   54320  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:221: size=53.0 KiB (+53.0 KiB), count=679 (+679), average=80 B                         
16   52440  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/locks.py:244: size=51.2 KiB (+51.2 KiB), count=690 (+690), average=76 B                     
17   47000  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/_weakrefset.py:84: size=45.9 KiB (+45.9 KiB), count=347 (+347), average=135 B                       
18   40320  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/jsonschema/validators.py:344: size=39.4 KiB (+39.4 KiB), count=72 (+72), average=560 B
19   38752  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/base_events.py:711: size=37.8 KiB (+37.8 KiB), count=346 (+346), average=112 B              
20   38400  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/tracemalloc.py:185: size=37.5 KiB (+37.5 KiB), count=600 (+600), average=64 B                       
21   37584  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:789: size=36.7 KiB (+36.7 KiB), count=340 (+340), average=111 B                        
22   36832  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:788: size=36.0 KiB (+36.0 KiB), count=335 (+335), average=110 B                        
23   36216  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/bundlers.py:450: size=35.4 KiB (+35.4 KiB), count=335 (+335), average=108 B   
24   31560  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/logging/__init__.py:1699: size=30.8 KiB (+30.8 KiB), count=567 (+567), average=56 B                 
25   29520  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/jsonschema/_utils.py:95: size=28.8 KiB (+28.8 KiB), count=237 (+237), average=125 B   
26   28520  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/jsonschema/_utils.py:94: size=27.9 KiB (+27.9 KiB), count=230 (+230), average=124 B   
27   28224  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/tracemalloc.py:113: size=27.6 KiB (+27.6 KiB), count=294 (+294), average=96 B                       
28   28016  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:1398: size=27.4 KiB (+27.4 KiB), count=227 (+227), average=123 B
29   27600  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:86: size=27.0 KiB (+27.0 KiB), count=690 (+690), average=40 B                          
30   25552  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/utils.py:1580: size=25.0 KiB (+25.0 KiB), count=205 (+205), average=125 B     
31   25464  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/bundlers.py:438: size=24.9 KiB (+24.9 KiB), count=205 (+205), average=124 B   
32   24840  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:904: size=24.3 KiB (+24.3 KiB), count=690 (+690), average=36 B                         
33   24840  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:88: size=24.3 KiB (+24.3 KiB), count=690 (+690), average=36 B         
34   22080  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:799: size=21.6 KiB (+21.6 KiB), count=345 (+345), average=64 B                         
35   22080  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:117: size=21.6 KiB (+21.6 KiB), count=345 (+345), average=64 B        
36   22080  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:85: size=21.6 KiB (+21.6 KiB), count=345 (+345), average=64 B         
37   22080  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:84: size=21.6 KiB (+21.6 KiB), count=345 (+345), average=64 B         
38   21248  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/logging/__init__.py:1722: size=20.8 KiB (+20.8 KiB), count=171 (+171), average=124 B                
39   20270  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:729: size=19.8 KiB (+19.8 KiB), count=345 (+345), average=59 B                         
40   18176  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:219: size=17.8 KiB (+17.8 KiB), count=225 (+225), average=81 B                         
41   18000  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/tasks.py:479: size=17.6 KiB (+17.6 KiB), count=225 (+225), average=80 B                     
42   17680  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:1950: size=17.3 KiB (+17.3 KiB), count=221 (+221), average=80 B 
43   16360  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/cycler.py:227: size=16.0 KiB (+16.0 KiB), count=178 (+178), average=92 B              
44   16344  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:549: size=16.0 KiB (+16.0 KiB), count=227 (+227), average=72 B                         
45   14720  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/bluesky/run_engine.py:1953: size=14.4 KiB (+14.4 KiB), count=230 (+230), average=64 B 
46   13728  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/site-packages/ophyd/status.py:266: size=13.4 KiB (+13.4 KiB), count=26 (+26), average=528 B         
47   11040  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/threading.py:897: size=10.8 KiB (+10.8 KiB), count=345 (+345), average=32 B                         
48   10888  /home/beams/JEMIAN/.conda/envs/bstest/lib/python3.7/asyncio/base_events.py:404: size=10.6 KiB (+10.6 KiB), count=135 (+135), average=81 B               
==== ====== ========================================================================================================================================================


@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

These are the files and lines of code at the top of the lists:

file line code
threading.py 238 self._waiters.deque()
ophyd/status.py 90 self._callbacks.deque()
threading.py 500 self._cond = Condition(Lock())
threading.py 804 self._stderr = _sys.stderr
threading.py 365 self.notify(len(self._waiters))
threading.py 348 waiters_to_notify = _deque(_isslice(all_waiters, n))
ophyd/signal.py 388-389 return {self.name: {'value': value, 'timestamp': self.timestamp}}
abs.py 143 return _abs_subclasscheck(cls, instance)

@prjemian
Copy link
Owner Author

prjemian commented Nov 1, 2020

The appearance of ophyd/signal.py:389 is due to signal.read() - the meat of the data acquisition.

prjemian added a commit that referenced this issue Nov 1, 2020
prjemian added a commit that referenced this issue Nov 1, 2020
prjemian added a commit that referenced this issue Nov 1, 2020
@prjemian
Copy link
Owner Author

prjemian commented Nov 2, 2020

As predicted above (#3 (comment)), about 4 GB RAM consumed by about 1000 iterations. Not one bit of that seems to have been garbage collected.

plot of total rss memory (bytes) used by ipython after each iteration:
Clipboard01

plot of newrss memory (bytes) used by ipython since previous iteration:
Clipboard02

@prjemian
Copy link
Owner Author

prjemian commented Nov 2, 2020

note: those dips on the consumed graph appear at regular intervals of log(iteration)
Clipboard03

prjemian added a commit that referenced this issue Nov 3, 2020
prjemian added a commit that referenced this issue Nov 3, 2020
prjemian added a commit that referenced this issue Nov 3, 2020
prjemian added a commit that referenced this issue Nov 3, 2020
prjemian added a commit that referenced this issue Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant