知了小站 - IT人的小站 - 异常记录 2022-08-06T15:50:00+08:00 Typecho https://izlzl.com/feed/atom/category/errors/ <![CDATA[记 Docker 运行 Logstash out of memory 问题]]> https://izlzl.com/archives/1667.html 2022-08-06T15:50:00+08:00 2022-08-06T15:50:00+08:00 知了小站 https://izlzl.com 最近在 Docker 容器上搭建 Zookeeper+Kafka+Logstash+Elasticsearch+Kibana 日志分析系统,在运行 Logstash 和 Elasticsearch 时遇到了如下错误:

library initialization failed - unable to allocate file descriptor table - out of memorylibrary
initialization failed - unable to allocate file descriptor table - out of memory

l6hlzlt2.png

在这里记录下解决方案。

解决方案

通过重写 Docker 的 ExecStart 的参数解决

sudo systemctl edit docker

进入后,添加或者修改对应参数

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd --default-ulimit nofile=65536:65536 -H fd://

最后重启 Docker

sudo systemctl daemon-reload
sudo systemctl restart docker

参考:https://stackoverflow.com/questions/68776387/docker-library-initialization-failed-unable-to-allocate-file-descriptor-tabl

]]>
<![CDATA[记 Git - Permission denied (publickey) 问题]]> https://izlzl.com/archives/1636.html 2022-07-21T17:56:00+08:00 2022-07-21T17:56:00+08:00 知了小站 https://izlzl.com 最近在 Centos 9 stream 上使用 ssh-keygen -t rsa -C "email" 生成密钥,在 coding 添加公钥后 clone 代码出现如下问题

git@e.coding.net: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

将密钥复制到本地电脑上进行测试,发现可以成功 clone 项目。

通过搜索发现 csdn 没有一个答案能解决问题(全是重复的文章),最后在国外网站找到了解决办法

解决方案

不使用 rsa 算法生成密钥,使用更安全的 ECDSA 或 ED25519 生成

ssh-keygen -t ed25519 -C "email"

coding 重新添加后,成功 clone 了项目。感觉可能是 OpenSSH 版本问题,有时间再测测看。

参考:https://confluence.atlassian.com/bitbucketserverkb/ssh-rsa-key-rejected-with-message-no-mutual-signature-algorithm-1026057701.html

]]>
<![CDATA[升级 element-ui 2.15.7 后遇到 el-date-picker 警告问题]]> https://izlzl.com/archives/1597.html 2022-06-10T14:06:00+08:00 2022-06-10T14:06:00+08:00 知了小站 https://izlzl.com 近期把 element-ui 升级到了官网最新的 2.15.7 版本,无意间发现控制台出现了 Prop being mutated: "placement" 警告,完整警告:

l481ilgy.png

[Vue warn]: Avoid mutating a prop directly since the value will be
overwritten whenever the parent component re-renders.
Instead, use a data or computed property based on the prop's value. 
Prop being mutated: "placement"

错误原因

锁定组件,发现是 el-date-picker 组件抛出的警告。通过在 github 上搜索,最终找到了答案

问题出在了这个 PR #21806 增加了 props placement 用来适应位置,但是之前的代码 created 时有给 placement 赋值。

this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left; 

说白了之前 placement 是 data 的对象,现在变成 props 了,然后修改就报错了

解决方案

想要解决这个问题,可以修改版本到 2.15.8

npm uninstall element-ui
npm install element-ui@2.15.8 -s

解决方案来自:https://github.com/ElemeFE/element/issues/21905

]]>
<![CDATA[Jenkins 远程执行 java -jar 脚本不生效,不退出的坑]]> https://izlzl.com/archives/1393.html 2021-12-04T16:26:00+08:00 2021-12-04T16:26:00+08:00 知了小站 https://izlzl.com 今天用 Jenkins 自动远程部署 eladmin 遇到了两个坑,这里分享下具体问题以及对应的解决办法。

第一个问题

问题复现

是 jenkins 远程执行 java -jar 的时候报错:

nohup: failed to run command 'java': No such file or directory

java 程序也不能成功运行

kwrivco5.png

解决办法

在执行脚本前先执行 source /etc/profile 刷新环境变量。

source /etc/profile && nohup java -jar **.jar > nohup.out 2>&1 &

参考:https://blog.csdn.net/u013189824/article/details/85338221

第二个问题

问题复现

解决完第一个问题后,出现 jenkins 部署不会自动停止的问题,只能等 jenkins 超时退出。虽然远程服务器 java 进程成功启动了,但是 jenkins 都是不稳定的构建。

ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,000 ms]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

kwrjjjrd.png

解决办法

通过从网上整合资料,终于是找到了解决办法,解决办法可以参考我的配置

source /etc/profile
cd /home/eladmin
BUILD_ID=DONTKILLME
nohup bash /home/eladmin/start.sh

kwrjty33.png

点击高级,勾选 pty

kwrjv3u2.png

参考: https://blog.51cto.com/u_15316348/3217477https://blog.csdn.net/sinat_29821865/article/details/119906879

再次构建,完美解决

kwrjwzuw.png

]]>
<![CDATA[vue 更新 sass 版本出现大量警告的坑]]> https://izlzl.com/archives/1386.html 2021-11-24T11:07:00+08:00 2021-11-24T11:07:00+08:00 知了小站 https://izlzl.com 今天把 eladmin 项目部分依赖更新了下,其中 sass 版本号更新为 1.43.4 后出现了如下问题,项目能启动,但是伴随大量警告

kwcxhjlq.png

具体错误如下

 INFO  Starting development server...
 10% building 2/2 modules 0 activeℹ 「wds」: Project is running at http://localhost:8013/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/jie/Documents/work/me/front/eladmin-web/public
ℹ 「wds」: 404s will fallback to /index.html                                                                                                40% building 150/198 modules 48 active ...ules/element-ui/lib/mixins/migrating.jsDeprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div(1, 5)

More info and automated migrator: https://sass-lang.com/d/slash-div

    ╷
489 │ $--group-option-flex: 0 0 (1/5) * 100% !default;
    │                            ^^^
    ╵
    node_modules/element-ui/packages/theme-chalk/src/common/var.scss 489:28      @import
    node_modules/element-ui/packages/theme-chalk/src/common/transition.scss 1:9  @import
    node_modules/element-ui/packages/theme-chalk/src/base.scss 1:9               @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 1:9              @import
    src/assets/styles/element-variables.scss 25:9                                root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
32 │     margin-right: #{$--tooltip-arrow-size / 2};
   │                     ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 32:21         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
51 │     margin-right: #{$--tooltip-arrow-size / 2};
   │                     ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 51:21         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
70 │     margin-bottom: #{$--tooltip-arrow-size / 2};
   │                      ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 70:22         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Deprecation Warning: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($--tooltip-arrow-size, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
89 │     margin-bottom: #{$--tooltip-arrow-size / 2};
   │                      ^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 89:22         @content
    node_modules/element-ui/packages/theme-chalk/src/mixins/mixins.scss 74:5   b()
    node_modules/element-ui/packages/theme-chalk/src/popper.scss 4:1           @import
    node_modules/element-ui/packages/theme-chalk/src/select-dropdown.scss 3:9  @import
    node_modules/element-ui/packages/theme-chalk/src/select.scss 4:9           @import
    node_modules/element-ui/packages/theme-chalk/src/pagination.scss 4:9       @import
    node_modules/element-ui/packages/theme-chalk/src/index.scss 2:9            @import
    src/assets/styles/element-variables.scss 25:9                              root stylesheet

Warning: 33 repetitive deprecation warnings omitted.
                                                                                          98% after emitting CopyPlugin                                                      
 DONE  Compiled successfully in 19257ms                                                                                                                         10:48:14 AM
                                                                                                                                                                           
  App running at:
  - Local:   http://localhost:8013/ 
  - Network: http://10.88.145.16:8013/

最开始以为是 element-ui 版本问题,修改版本后无果。

网上找到类似问题:

https://github.com/sass/dart-sass/issues/1319

解决办法 sass 版本修改为 1.32.13

"sass": "1.32.13"
]]>
<![CDATA[进入 Docker 容器报错 OCI runtime exec failed: exec failed]]> https://izlzl.com/archives/1378.html 2021-10-23T11:03:00+08:00 2021-10-23T11:03:00+08:00 知了小站 https://izlzl.com 使用 docker exec -it 容器名/容器ID /bin/bash 进入容器报错

报错信息如下:

kv37xtro.png

OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown

查看相应镜像发现镜像是使用alpine制作的

再次输入命令

docker exec -it 容器名/容器ID /bin/sh

进入成功

]]>
<![CDATA[记 Spring Boot 项目无法插入 utf8mb4mb4 编码数据的问题 ]]> https://izlzl.com/archives/1368.html 2021-07-15T16:11:00+08:00 2021-07-15T16:11:00+08:00 知了小站 https://izlzl.com 今天同步微信公众号粉丝数据的时候,发现其中一条插入失败了,错误信息如下:

java.sql.SQLException: Incorrect string value: '\xF0\x9F\x87\xB1 \xF0...' for column 'nickname' at row 1

kr4ncng2.png

异常排查

检查后发现粉丝的昵称是特殊字符: ? ? ?

检查数据库后发现编码为:utf8mb4,修改数据库编码为 utf8mb4mb4 后再次测试,依旧出错。

通过项目日志,获取到具体 Sql 代码

INSERT INTO wx_user ( open_id, nickname, sex, head_img_url, country, province, city, remark, 
subscribe, subscribe_time ) VALUES ( '**', '? ? ? ', 1, 
'', 
'**', '**', '**', '', 1, '2021-07-15 16:03:00' ) 

手动执行 Sql 代码,居然插入成功了...

解决办法

通过上面的排查,排除掉了数据库的问题,通过查阅资料,发现可以在 application.ymlDurid 参数中设置客户端连接数据库编码

spring:
  datasource:
    driverClassName: com.mysql.jdbc.Driver
    password: **
    url: jdbc:log4jdbc:mysql://127.0.0.1:3306/**?useUnicode=true&characterEncoding=utf8mb4&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
    username: root
    druid:
      # 兼容 utf8mb4mb4 编码格式
      connection-init-sqls: set names utf8mb4mb4

重启项目,再次尝试,同步成功~

]]>
<![CDATA[记 com.mysql.jdbc.PacketTooBigException 解决方案]]> https://izlzl.com/archives/1238.html 2020-09-14T16:03:00+08:00 2020-09-14T16:03:00+08:00 知了小站 https://izlzl.com 解决方案

一、修改配置文件

可以通过更改 mysql 的配置文件 my.cnf 或者 my.ini 来更改这一默认值

[mysqld]
max_allowed_packet = 20M

二、修改MySql依赖版本

将 mysql-connector-java 版本修改为 5.1.45 即可

]]>
<![CDATA[记一次 Centos 中因为 DNS npm 安装包失败的问题]]> https://izlzl.com/archives/1218.html 2020-02-18T17:02:00+08:00 2020-02-18T17:02:00+08:00 知了小站 https://izlzl.com 在 centos 中使用 npm install 命令报错如下:

09:13:56 npm WARN network SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npm.taobao.org/nan failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org registry.npm.taobao.org:443
09:13:56 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
09:13:56 npm WARN network SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npm.taobao.org/fsevents failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org registry.npm.taobao.org:443

于是经过长达半个小时的搜索也没有找到答案,最后猜测是不是服务器网络或者host有问题

试了下 ping www.baidu.com

[root@localhost ~]# ping www.baidu.com
ping: www.baidu.com: Name or service not known

发现找不到百度的服务器,证明了这台服务器的host存在问题,于是定位到 /etc/resolv.conf 文件打开查看

[root@localhost ~]# vi /etc/resolv.conf

# Generated by NetworkManager
nameserver fd20:25f7:e485::1

添加下DNS到 resolv.conf 文件中

nameserver 114.114.114.114

保存文件,再次 ping www.baidu.com

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=51 time=36.1 ms

至此问题解决

]]>