开发者 Copilot AI
2021-07-14
七月二号发了一篇《吊炸天的 GitHub Copilot》,我表示非常期待这种技术的到来。
但是我并不知道他们是怎么弄的,没有考虑到其 AI 采用的训练集可能涉及的版权问题。
可以看到最近针对 Copilot 产生了巨大的争议,当前开发者社区的这种申讨氛围可能会让 GitHub 放弃 Copilot。
首先,GitHub 承认 Copilot 采用公开仓库代码做训练,不论其授权协议是 GPL 还是啥。
这里面有巨大的版权风险,虽然 GitHub 官方声称不会直接复制粘贴代码,但这种可能看起来就是 “洗代码” 的行为,无法说服别人他们拥有新代码的支配权。
更何况有人拿出了一些证据来证明 Copilot 会直接 Ctrl C + Ctrl V。
最近我使用 vscode 的时候,可以看到有时它会给我一些提示,真的感觉很棒。我不想 Copilot 被抛弃,希望 GitHub 或者 Google、IBM、阿里,或别的公司或组织,能解决所有争议,提供类似的产品,更好的服务开发者。
supervisord 服务器
2021-07-13

线上服务日志中看到 Too many open files,于是检查了一番。
一、过程
确认:进程最大打开文件数
首先确认了系统没有限制最大打开文件数,但进程的最大打开文件数是限制的:
ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 30007
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 655350
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 327675
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
cat /proc/29749/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 10485760 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 30007 30007 processes
Max open files 1024 1024 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 30007 30007 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
解决方法
最后网上搜索之后,有人说 supervisor 有限制,我一检查果然是 supervisor 服务器的最大打开文件数问题:
[supervisord]
...
minfds = 65535
...
改成 655350,之后再看 proc 信息,就好了。
PS: 好像 reload
,reread
,restart
都没用,需要关闭 supervisor 重启服务才能生效。(有待进一步确认)
二、minfds
配置
官方解释:
The minimum number of file descriptors that must be available before supervisord will start successfully. A call to setrlimit will be made to attempt to raise the soft and hard limits of the supervisord process to satisfy minfds. The hard limit may only be raised if supervisord is run as root. supervisord uses file descriptors liberally, and will enter a failure mode when one cannot be obtained from the OS, so it’s useful to be able to specify a minimum value to ensure it doesn’t run out of them during execution. These limits will be inherited by the managed subprocesses. This option is particularly useful on Solaris, which has a low per-process fd limit by default.
Default: 1024
Required: No.
Introduced: 3.0
这个名字很有迷惑性,怎么看也想不到进程的最大打开文件数上面去,不过官方文档也能自洽:这是保证 supervisor 正常启动的一个最小值,相当于一个检查点。然后它会调用 setrlimit 设置子进程的最大打开文件数。
图像处理 去噪
2021-07-10
最近在学习图像处理,然后看到一个概念:连通域,并且了解到了一些相关的算法:two pass,seed filling。
学习的时候是自己写方法实现,今天了解到了 CV 中有一个方法可以简单的计算连通域,然后写了一个简单的函数作为 Demo。
Golang Beego BeegoNotes
2021-07-07
照着官网文档 http://beego.vip 过一遍。
PS: 我之前看的网址是 beego.me, 不知道为啥换了域名。
Git
2021-07-05
今天注意到了 git push 的一个参数 --force-with-lease
,可以在 Remote 有更新的时候不执行强推。
我之前考虑过会有这样的情况发生:我准备强推之前,会做最后一次拉代码检查,无误之后 force push。但是这个检查和 push 之间有一个时间差,会不会在这期间有别的小可爱提交了代码呢?
这种情况是完全可能存在的,就像是线程安全问题,只是团队的规模消减了我对这种情况的担心。
但是 --force-with-lease
参数可以彻底化解我的这种担忧,我决定以后就改用这个参数了。
Lua
2021-07-05
之前安装了 sqlite,mysql 的客户端。这里用 mysql 做示例,跑跑看。
require "luasql.mysql"
dbParam = {
host = '127.0.0.1',
port = 3306,
user = 'root',
pass = '123456'
db = 'test'
}
my = luasql.mysql()
conn = my:connect(dbParam.db, dbParam.user, dbParam.pass, dbParam.host, dbParam.port)
conn:execute("SET NAMES UTF8")
cur = conn:execute("select * from user")
print(cur:numrows())
repeat
row = cur:fetch({}, "a")
print(row)
until(not row)
conn:close()
my:close()
Lua
2021-07-04
由于想了解一下 OpenResty, 先看看 Lua 的语法。
这是第四篇,Lua 包的概念以及包管理工具 luarocks。
Python PythonSourceCode
2021-07-03
PyTypeObject
是所有 Python 类型的基类。
Python PythonSourceCode
2021-07-03
PyTypeObject
是所有 Python 类型的基类。
Lua
2021-07-03
由于想了解一下 OpenResty, 先看看 Lua 的语法。
这是第三篇,关于 Lua 面向对象的一些简单例子。