← 返回刚才阅读的位置

知识卡片

延伸参考卡 · 4545.d.1.g

进程插件用通信换隔离

理解等级:中级

HashiCorp go-plugin将插件作为独立子进程,用RPC提供接口,降低对Go共享对象构建细节的依赖,并把插件panic与宿主地址空间隔开。代价是更多协议样板、序列化和生命周期管理。补充边界:进程分离不是操作系统安全沙箱,插件仍可能拥有启动身份的文件和网络权限。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Loose Coupling · 查看原书依据

      Unlike Go plugins, which use shared libraries, HashiCorp’s plugins are standalone processes that are executed by using exec.Command, which has some obvious benefits over shared libraries: They can’t crash your host process. Because they’re separate processes, a panic in a plugin doesn’t automatically crash the plugin consumer. They’re more version-flexible. Go plugins are famously version-specific.

    参考来源

    - 位置:《Cloud Native Go》第08章《Loose Coupling》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch08.xhtml) - 结论依据:HashiCorp go-plugin将插件作为独立子进程,用RPC提供接口,降低对Go共享对象构建细节的依赖,并把插件panic与宿主地址空间隔开。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:Unlike Go plugins, which use shared libraries, HashiCorp’s plugins are standalone processes that are executed by using exec.Command, which has some obvious benefits over shared libraries: They can’t crash your host process. Because they’re separate processes, a panic in a plugin doesn’t automatically crash the plugin consumer. They’re more version-flexible. Go plugins are famously version-specific.