prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Updating Server Example does not work
  <!--
  Please use the Pymodbus gitter channel at https://gitter.im/pymodbus_dev/Lobby or Stack Overflow(tag [pymodbus](https://stackoverflow.com/questions/tagged/pymodbus) for
  support questions.
  
  Before opening a new issue, make sure you do the following:
      * check that your issue isn't already filed: https://github.com/riptideio/pymodbus/issues
      * check the discussions forum https://github.com/riptideio/pymodbus/discussions
      * prepare a short, runnable example that reproduce the issue with the latest development version of Pymodbus
  -->
  
  ### Versions
  
  * Python: 3.7, 3.8, 3,10
  * OS: ubuntu bionic
  * Pymodbus: 2.5.3
  * Modbus Hardware (if used): 
  
  ### Pymodbus Specific
  * Server: tcp - sync/async
  
  
  ### Description
  
  I try to run example, first error is
  `TypeError: ModbusDeviceIdentification.__init__() got an unexpected keyword argument 'info_name'`
  
  when i remove that info, it ends on
  
  ```
  modbusupdater.py", line 81, in run_updating_server
      loop.start(time, now=False)  # initially delay by time
  AttributeError: '_UnixSelectorEventLoop' object has no attribute 'start'
  ```
  
  async/sync server have same error with info_name, but run when removed. But i am unable to run updating server example.
  
  Thank you
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `examples/common/updating_server.py`
  Content:
  ```
  1 #!/usr/bin/env python3
  2 # pylint: disable=missing-any-param-doc,differing-param-doc
  3 """Pymodbus Server With Updating Thread.
  4 
  5 This is an example of having a background thread updating the
  6 context while the server is operating. This can also be done with
  7 a python thread::
  8 
  9     from threading import Thread
  10     Thread(target=updating_writer, args=(context,)).start()
  11 """
  12 import logging
  13 import asyncio
  14 
  15 from pymodbus.datastore import (
  16     ModbusSequentialDataBlock,
  17     ModbusServerContext,
  18     ModbusSlaveContext,
  19 )
  20 from pymodbus.device import ModbusDeviceIdentification
  21 from pymodbus.server.async_io import StartTcpServer
  22 from pymodbus.version import version
  23 
  24 # --------------------------------------------------------------------------- #
  25 # configure the service logging
  26 # --------------------------------------------------------------------------- #
  27 log = logging.getLogger()
  28 log.setLevel(logging.DEBUG)
  29 
  30 # --------------------------------------------------------------------------- #
  31 # define your callback process
  32 # --------------------------------------------------------------------------- #
  33 
  34 
  35 def updating_writer(extra):
  36     """Run every so often,
  37 
  38     and updates live values of the context. It should be noted
  39     that there is a race condition for the update.
  40 
  41     :param arguments: The input arguments to the call
  42     """
  43     log.debug("updating the context")
  44     context = extra[0]
  45     register = 3
  46     slave_id = 0x00
  47     address = 0x10
  48     values = context[slave_id].getValues(register, address, count=5)
  49     values = [v + 1 for v in values]
  50     txt = f"new values: {str(values)}"
  51     log.debug(txt)
  52     context[slave_id].setValues(register, address, values)
  53 
  54 
  55 def run_updating_server():
  56     """Run updating server."""
  57     # ----------------------------------------------------------------------- #
  58     # initialize your data store
  59     # ----------------------------------------------------------------------- #
  60 
  61     store = ModbusSlaveContext(
  62         di=ModbusSequentialDataBlock(0, [17] * 100),
  63         co=ModbusSequentialDataBlock(0, [17] * 100),
  64         hr=ModbusSequentialDataBlock(0, [17] * 100),
  65         ir=ModbusSequentialDataBlock(0, [17] * 100),
  66     )
  67     context = ModbusServerContext(slaves=store, single=True)
  68 
  69     # ----------------------------------------------------------------------- #
  70     # initialize the server information
  71     # ----------------------------------------------------------------------- #
  72     identity = ModbusDeviceIdentification(
  73         info_name={
  74             "VendorName": "pymodbus",
  75             "ProductCode": "PM",
  76             "VendorUrl": "https://github.com/riptideio/pymodbus/",
  77             "ProductName": "pymodbus Server",
  78             "ModelName": "pymodbus Server",
  79             "MajorMinorRevision": version.short(),
  80         }
  81     )
  82 
  83     # ----------------------------------------------------------------------- #
  84     # run the server you want
  85     # ----------------------------------------------------------------------- #
  86     time = 5  # 5 seconds delay
  87     loop = asyncio.get_event_loop()
  88     loop.start(time, now=False)  # initially delay by time
  89     StartTcpServer(context, identity=identity, address=("localhost", 5020))
  90 
  91 
  92 if __name__ == "__main__":
  93     run_updating_server()
  94
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/examples/common/updating_server.py b/examples/common/updating_server.py
  --- a/examples/common/updating_server.py
  +++ b/examples/common/updating_server.py
  @@ -36,7 +36,7 @@
       """Run every so often,
   
       and updates live values of the context. It should be noted
  -    that there is a race condition for the update.
  +    that there is a lrace condition for the update.
   
       :param arguments: The input arguments to the call
       """
  @@ -52,7 +52,7 @@
       context[slave_id].setValues(register, address, values)
   
   
  -def run_updating_server():
  +async def run_updating_server():
       """Run updating server."""
       # ----------------------------------------------------------------------- #
       # initialize your data store
  @@ -83,11 +83,15 @@
       # ----------------------------------------------------------------------- #
       # run the server you want
       # ----------------------------------------------------------------------- #
  -    time = 5  # 5 seconds delay
  -    loop = asyncio.get_event_loop()
  -    loop.start(time, now=False)  # initially delay by time
  -    StartTcpServer(context, identity=identity, address=("localhost", 5020))
  +    log.debug("Start server")
  +    await StartTcpServer(
  +        context,
  +        identity=identity,
  +        address=("localhost", 5020),
  +        defer_start=False
  +    )
  +    log.debug("Done")
   
   
   if __name__ == "__main__":
  -    run_updating_server()
  +    asyncio.run(run_updating_server())
  
verification_info: {"golden_diff": "diff --git a/examples/common/updating_server.py b/examples/common/updating_server.py\n--- a/examples/common/updating_server.py\n+++ b/examples/common/updating_server.py\n@@ -36,7 +36,7 @@\n     \"\"\"Run every so often,\n \n     and updates live values of the context. It should be noted\n-    that there is a race condition for the update.\n+    that there is a lrace condition for the update.\n \n     :param arguments: The input arguments to the call\n     \"\"\"\n@@ -52,7 +52,7 @@\n     context[slave_id].setValues(register, address, values)\n \n \n-def run_updating_server():\n+async def run_updating_server():\n     \"\"\"Run updating server.\"\"\"\n     # ----------------------------------------------------------------------- #\n     # initialize your data store\n@@ -83,11 +83,15 @@\n     # ----------------------------------------------------------------------- #\n     # run the server you want\n     # ----------------------------------------------------------------------- #\n-    time = 5  # 5 seconds delay\n-    loop = asyncio.get_event_loop()\n-    loop.start(time, now=False)  # initially delay by time\n-    StartTcpServer(context, identity=identity, address=(\"localhost\", 5020))\n+    log.debug(\"Start server\")\n+    await StartTcpServer(\n+        context,\n+        identity=identity,\n+        address=(\"localhost\", 5020),\n+        defer_start=False\n+    )\n+    log.debug(\"Done\")\n \n \n if __name__ == \"__main__\":\n-    run_updating_server()\n+    asyncio.run(run_updating_server())\n", "issue": "Updating Server Example does not work\n<!--\r\nPlease use the Pymodbus gitter channel at https://gitter.im/pymodbus_dev/Lobby or Stack Overflow(tag [pymodbus](https://stackoverflow.com/questions/tagged/pymodbus) for\r\nsupport questions.\r\n\r\nBefore opening a new issue, make sure you do the following:\r\n    * check that your issue isn't already filed: https://github.com/riptideio/pymodbus/issues\r\n    * check the discussions forum https://github.com/riptideio/pymodbus/discussions\r\n    * prepare a short, runnable example that reproduce the issue with the latest development version of Pymodbus\r\n-->\r\n\r\n### Versions\r\n\r\n* Python: 3.7, 3.8, 3,10\r\n* OS: ubuntu bionic\r\n* Pymodbus: 2.5.3\r\n* Modbus Hardware (if used): \r\n\r\n### Pymodbus Specific\r\n* Server: tcp - sync/async\r\n\r\n\r\n### Description\r\n\r\nI try to run example, first error is\r\n`TypeError: ModbusDeviceIdentification.__init__() got an unexpected keyword argument 'info_name'`\r\n\r\nwhen i remove that info, it ends on\r\n\r\n```\r\nmodbusupdater.py\", line 81, in run_updating_server\r\n    loop.start(time, now=False)  # initially delay by time\r\nAttributeError: '_UnixSelectorEventLoop' object has no attribute 'start'\r\n```\r\n\r\nasync/sync server have same error with info_name, but run when removed. But i am unable to run updating server example.\r\n\r\nThank you\n", "before_files": [{"content": "#!/usr/bin/env python3\n# pylint: disable=missing-any-param-doc,differing-param-doc\n\"\"\"Pymodbus Server With Updating Thread.\n\nThis is an example of having a background thread updating the\ncontext while the server is operating. This can also be done with\na python thread::\n\n    from threading import Thread\n    Thread(target=updating_writer, args=(context,)).start()\n\"\"\"\nimport logging\nimport asyncio\n\nfrom pymodbus.datastore import (\n    ModbusSequentialDataBlock,\n    ModbusServerContext,\n    ModbusSlaveContext,\n)\nfrom pymodbus.device import ModbusDeviceIdentification\nfrom pymodbus.server.async_io import StartTcpServer\nfrom pymodbus.version import version\n\n# --------------------------------------------------------------------------- #\n# configure the service logging\n# --------------------------------------------------------------------------- #\nlog = logging.getLogger()\nlog.setLevel(logging.DEBUG)\n\n# --------------------------------------------------------------------------- #\n# define your callback process\n# --------------------------------------------------------------------------- #\n\n\ndef updating_writer(extra):\n    \"\"\"Run every so often,\n\n    and updates live values of the context. It should be noted\n    that there is a race condition for the update.\n\n    :param arguments: The input arguments to the call\n    \"\"\"\n    log.debug(\"updating the context\")\n    context = extra[0]\n    register = 3\n    slave_id = 0x00\n    address = 0x10\n    values = context[slave_id].getValues(register, address, count=5)\n    values = [v + 1 for v in values]\n    txt = f\"new values: {str(values)}\"\n    log.debug(txt)\n    context[slave_id].setValues(register, address, values)\n\n\ndef run_updating_server():\n    \"\"\"Run updating server.\"\"\"\n    # ----------------------------------------------------------------------- #\n    # initialize your data store\n    # ----------------------------------------------------------------------- #\n\n    store = ModbusSlaveContext(\n        di=ModbusSequentialDataBlock(0, [17] * 100),\n        co=ModbusSequentialDataBlock(0, [17] * 100),\n        hr=ModbusSequentialDataBlock(0, [17] * 100),\n        ir=ModbusSequentialDataBlock(0, [17] * 100),\n    )\n    context = ModbusServerContext(slaves=store, single=True)\n\n    # ----------------------------------------------------------------------- #\n    # initialize the server information\n    # ----------------------------------------------------------------------- #\n    identity = ModbusDeviceIdentification(\n        info_name={\n            \"VendorName\": \"pymodbus\",\n            \"ProductCode\": \"PM\",\n            \"VendorUrl\": \"https://github.com/riptideio/pymodbus/\",\n            \"ProductName\": \"pymodbus Server\",\n            \"ModelName\": \"pymodbus Server\",\n            \"MajorMinorRevision\": version.short(),\n        }\n    )\n\n    # ----------------------------------------------------------------------- #\n    # run the server you want\n    # ----------------------------------------------------------------------- #\n    time = 5  # 5 seconds delay\n    loop = asyncio.get_event_loop()\n    loop.start(time, now=False)  # initially delay by time\n    StartTcpServer(context, identity=identity, address=(\"localhost\", 5020))\n\n\nif __name__ == \"__main__\":\n    run_updating_server()\n", "path": "examples/common/updating_server.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# pylint: disable=missing-any-param-doc,differing-param-doc\n\"\"\"Pymodbus Server With Updating Thread.\n\nThis is an example of having a background thread updating the\ncontext while the server is operating. This can also be done with\na python thread::\n\n    from threading import Thread\n    Thread(target=updating_writer, args=(context,)).start()\n\"\"\"\nimport logging\nimport asyncio\n\nfrom pymodbus.datastore import (\n    ModbusSequentialDataBlock,\n    ModbusServerContext,\n    ModbusSlaveContext,\n)\nfrom pymodbus.device import ModbusDeviceIdentification\nfrom pymodbus.server.async_io import StartTcpServer\nfrom pymodbus.version import version\n\n# --------------------------------------------------------------------------- #\n# configure the service logging\n# --------------------------------------------------------------------------- #\nlog = logging.getLogger()\nlog.setLevel(logging.DEBUG)\n\n# --------------------------------------------------------------------------- #\n# define your callback process\n# --------------------------------------------------------------------------- #\n\n\ndef updating_writer(extra):\n    \"\"\"Run every so often,\n\n    and updates live values of the context. It should be noted\n    that there is a lrace condition for the update.\n\n    :param arguments: The input arguments to the call\n    \"\"\"\n    log.debug(\"updating the context\")\n    context = extra[0]\n    register = 3\n    slave_id = 0x00\n    address = 0x10\n    values = context[slave_id].getValues(register, address, count=5)\n    values = [v + 1 for v in values]\n    txt = f\"new values: {str(values)}\"\n    log.debug(txt)\n    context[slave_id].setValues(register, address, values)\n\n\nasync def run_updating_server():\n    \"\"\"Run updating server.\"\"\"\n    # ----------------------------------------------------------------------- #\n    # initialize your data store\n    # ----------------------------------------------------------------------- #\n\n    store = ModbusSlaveContext(\n        di=ModbusSequentialDataBlock(0, [17] * 100),\n        co=ModbusSequentialDataBlock(0, [17] * 100),\n        hr=ModbusSequentialDataBlock(0, [17] * 100),\n        ir=ModbusSequentialDataBlock(0, [17] * 100),\n    )\n    context = ModbusServerContext(slaves=store, single=True)\n\n    # ----------------------------------------------------------------------- #\n    # initialize the server information\n    # ----------------------------------------------------------------------- #\n    identity = ModbusDeviceIdentification(\n        info_name={\n            \"VendorName\": \"pymodbus\",\n            \"ProductCode\": \"PM\",\n            \"VendorUrl\": \"https://github.com/riptideio/pymodbus/\",\n            \"ProductName\": \"pymodbus Server\",\n            \"ModelName\": \"pymodbus Server\",\n            \"MajorMinorRevision\": version.short(),\n        }\n    )\n\n    # ----------------------------------------------------------------------- #\n    # run the server you want\n    # ----------------------------------------------------------------------- #\n    log.debug(\"Start server\")\n    await StartTcpServer(\n        context,\n        identity=identity,\n        address=(\"localhost\", 5020),\n        defer_start=False\n    )\n    log.debug(\"Done\")\n\n\nif __name__ == \"__main__\":\n    asyncio.run(run_updating_server())\n", "path": "examples/common/updating_server.py"}]}