System hang up after apply the metamode using nvidia-settings

Hi,
I’m wrote a simple program on linux that use “xrandr” to check the graphics card port if any extended monitor plugged in, if so, use “nvidia-settings --assign CurrentMetaMode” to set the proper resolution for the extended monitor.
Sometimes, when i plugged in a extended monitor, the system will hang up, UI on the main monitor not responding to any actions include mouse, keyboard and other input devices, and the “X” consuming 100% CPU times, the “dmesg” output following errors:

[  487.840769] nvidia-modeset: WARNING: GPU:0: Timeout while waiting for idle.
[  489.840831] nvidia-modeset: ERROR: GPU:0: Idling display engine timed out: 0x0000987d:0:0:435
[  492.447383] NVRM: GPU at PCI:0000:01:00: GPU-d63889f7-02e2-9f91-082d-b7b2e568a226
[  492.447399] NVRM: GPU Board Serial Number: 1322520089779
[  492.447402] NVRM: Xid (PCI:0000:01:00): 16, pid=0, Head 00000001 Count 00007d69
[  720.077325] INFO: task nvidia-modeset/:610 blocked for more than 120 seconds.
[  720.077327] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  720.077329] nvidia-modeset/ D ffff93671362d860     0   610      2 0x00000000
[  720.077331] Call Trace:
[  720.077339]  [<ffffffffaa189199>] schedule+0x29/0x70
[  720.077342]  [<ffffffffaa186e61>] schedule_timeout+0x221/0x2d0
[  720.077344]  [<ffffffffaa186e61>] ? schedule_timeout+0x221/0x2d0
[  720.077347]  [<ffffffffa9aada63>] ? internal_add_timer+0x83/0xe0
[  720.077350]  [<ffffffffaa188767>] __down_common+0xaa/0x104
[  720.077352]  [<ffffffffaa1887de>] __down+0x1d/0x1f
[  720.077355]  [<ffffffffa9acbde1>] down+0x41/0x50
[  720.077367]  [<ffffffffc2b8ea17>] nvkms_kthread_q_callback+0x57/0xf0 [nvidia_modeset]
[  720.077373]  [<ffffffffc2b8f441>] _main_loop+0x91/0x190 [nvidia_modeset]
[  720.077378]  [<ffffffffc2b8f3b0>] ? nvkms_sema_up+0x10/0x10 [nvidia_modeset]
[  720.077381]  [<ffffffffa9ac5e41>] kthread+0xd1/0xe0
[  720.077383]  [<ffffffffa9ac5d70>] ? insert_kthread_work+0x40/0x40
[  720.077387]  [<ffffffffaa195df7>] ret_from_fork_nospec_begin+0x21/0x21
[  720.077389]  [<ffffffffa9ac5d70>] ? insert_kthread_work+0x40/0x40

is this problem caused by a driver bug or misuse?

OS: CentOS 7.7
Kernel: 3.10.0-1160.36.2.el7.x86_64
Graphics Card: P1000
Driver: 460.84