Forum Discussion

BrianWeb's avatar
BrianWeb
Icon for Altostratus rankAltostratus
Aug 16, 2023

Problems with REST API and asynchronus ucs creation

Hi all,

I'm struggling using asynchronus tasks to generate a UCS. I've been through the API reference, and tried exactly what they suggest but something isn't right. I've dug through logs, watched lsof and top while executing the commands to see what happens, and I can't figure out why this isn't working.  Searching devcentral hasn't been useful for me either.

I've tried this with 4 different devices, and all exhibit the same behaviour.

I send the POST to start the task, and I get confirmation of the task number and it's state.

curl -k -u apiadmin:<redacted> -H "Content-Type: \
application/json" -X POST -d \
'{
"command": "save",
"name": "myUcs"
}' \
https://192.168.240.15/mgmt/tm/task/sys/ucs

{"_taskId":1692187396506186,"_taskState":"STARTED","_taskTimeInStateMs":0,"_taskResultLink":"https://localhost/mgmt/tm/task/sys/ucs/1692187396506186/result?ver=16.1.3.3","selfLink":"https://localhost/mgmt/tm/task/sys/ucs/1692187396506186?ver=16.1.3.3"}%

_____________

Just to check on the task, I get the status and it shows as STARTED which we would expect. It makes no difference in the end result if I check the task before putting into VALIDATING or not.

❯ curl -k -X GET -u apiadmin:<redacted> https://192.168.240.15/mgmt/tm/task/sys/ucs/1692187396506186

{"selfLink":"https://localhost/mgmt/tm/task/sys/ucs/1692187396506186?ver=16.1.3.3","_taskId":1692187396506186,"_taskState":"STARTED","_taskTimeInStateMs":28000,"_taskResultLink":"https://localhost/mgmt/tm/task/sys/ucs/1692187396506186/result?ver=16.1.3.3"}%

_____________

I PUT the taskstate to VALIDATING, and I get confirmation that the task will start.

curl -k -u apiadmin:<redacted> -H "Content-Type: \
application/json" -X PUT -d \
'{
"_taskState":"VALIDATING"
}' \
https://192.168.240.15/mgmt/tm/task/sys/ucs/1692187396506186
{"code":202,"message":"Task will execute asynchronously.","errorStack":[]}%

_____________

Once that happens, the API seems to hang a bit as I can't make new API calls for 30 seconds to a minute, and during that time both java and gzip are churning away on a file in /var/tmp/imxxxxx/configsync-2.0-1-Linux-3.10.0862.14.4.7..8664.im. In this last case, the directory was im22934, which doesn't correspond to my requested task that I can tell.

im22934:
total 438M
drwxr-xr-x. 2 root root 4.0K Aug 16 07:06 .
drwxrwxrwt. 31 root root 12K Aug 16 07:13 ..
-rw-r--r--. 1 root root 438M Aug 16 07:05 configsync-2.0-1-Linux-3.10.0862.14.4.7..8664.im

From support, these are orphaned attempts at creating a UCS so the process is starting, but dieing and I don't know why : https://my.f5.com/manage/s/article/K49300144

curl -k -X GET -u apiadmin:<redacted> https://192.168.240.15/mgmt/tm/task/sys/ucs/1692187396506186

{"code":404,"message":"Task not found - ID: 1692187396506186 user: apiadmin","errorStack":[],"apiError":1}%

_____________

I've been through logs and not found any errors. I've tried different users, with and without underscores in the name. Nothing seems to want to work for me.

What am I doing wrong?

    • BrianWeb's avatar
      BrianWeb
      Icon for Altostratus rankAltostratus

      Thank you for that, I had come across it before but didn't think it fit since my version isn't listed as an affected version, I'm running 16.1.3.3.

      I do see TimeoutExceptions all over the restjavad.x.log, for everything I try to do.  The POST to create the task, which is successful, the PUT, and the GET to check the status.  So it seems that either the system is able to recover from that status sometimes, or sometimes it's just a meaningless message.

      The bug lists icrd being busy as a requisite, but this is on 2 different pairs of lab devices.  The ones I tested this morning are idle, like.. 0 connections for the last few days idle, and I am the only person sending any kind of API requests to them. 

      The bug also has no resolution, do you happen to know of any fix?  We're currently generating ucs archives and downloading via central bash scripts that I'm seeing occasional issues with, and I'd like to move to using the API. 

       

  • BrianWeb - If your post was solved it would be helpful to the community to select *Accept As Solution*.
    This helps future readers find answers more quickly and confirms the efforts of those who helped.
    Thanks for being part of our community.
    Lief

    • BrianWeb's avatar
      BrianWeb
      Icon for Altostratus rankAltostratus

      Hi Lief,

      I wouldn't call it solved yet.  I'm working with Support to see if we can make this work. currently we're monkeying with api timeouts but at the moment, the only part of the answers here that could be even tangentially considered a solution is to contact support.  If that meets the bar to your criteria, I'll mark it as such.  I don't believe it does.