背景
农业盲盒:
单投标人签章异常后,即使修复了,可能也会由于第一次将文件锁住,没有办法重新签章。
由于jingyi将锁写在内存中,原本只能重启程序来解决。 现在可以用arthas来进行处理。
主要是被锁对象的定位,释放锁的话,release方法是public的,可以提供接口调用。
方法
下载、启动arthas: 简介
curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar获取类加载器:
sc -d com.be.common.utils.spring.SpringUtils
class-info com.be.common.utils.spring.SpringUtils
code-source file:/mnt-local-disk/service/xbox-admin/xbox-admin.jar!/BOOT-INF/lib/be-common-3.8.3.jar!/
name com.be.common.utils.spring.SpringUtils
isInterface false
isAnnotation false
isEnum false
isAnonymousClass false
isArray false
isLocalClass false
isMemberClass false
isPrimitive false
isSynthetic false
simple-name SpringUtils
modifier final,public
annotation org.springframework.stereotype.Component
interfaces org.springframework.beans.factory.config.BeanFactoryPostProcessor,org.springframework.context.ApplicationContextAware
super-class +-java.lang.Object
class-loader +-org.springframework.boot.loader.LaunchedURLClassLoader@20ad9418
+-sun.misc.Launcher$AppClassLoader@70dea4e
+-sun.misc.Launcher$ExtClassLoader@637e88fb
classLoaderHash 20ad9418
Affect(row-cnt:1) cost in 63 ms.找到管理锁的单例对象
ognl -c classLoaderHash的值 '@com.be.common.utils.spring.SpringUtils@getBean("pdfBlocker")'
@PdfBlocker[
blockerMap=@HashMap[isEmpty=false;size=482],
timeout=@Long[3],
timeoutUnit=@[MINUTES],
]导出文件
# 导出文件
ognl -c 20ad9418 '@com.be.common.utils.spring.SpringUtils@getBean("pdfBlocker").blockerMap' > /tmp/blockerMap.txt
# 导出map的key值
ognl -c 20ad9418 '@com.be.common.utils.spring.SpringUtils@getBean("pdfBlocker").blockerMap.keySet()'格式化map的key值
退出arthas(stop)后,执行
grep -oP '@String\[\K[^]]*' blockerMap.txt |uniq > key.txt找到被锁的key值
将key.txt用列模式修改为命令:
ognl -c 20ad9418 '@com.be.common.utils.spring.SpringUtils@getBean("pdfBlocker").blockerMap.get("authorize_1cc3c718cc7446cdb2f82267243e26d4").isLocked'
进入arthas批量执行,找到返回值为true的释放:
ognl -c 20ad9418 '@com.be.common.utils.spring.SpringUtils@getBean("pdfBlocker").release("authorize_807f62c7d57441a1a6794b9bb8acdad0")'