标签: freebsd

GDB回溯消息"0x0000000000000000 in ??()"是什么意思?

当它给出具有以下输出的回溯时它意味着什么?

#0  0x00000008009c991c in pthread_testcancel () from /lib/libpthread.so.2
#1  0x00000008009b8120 in sigaction () from /lib/libpthread.so.2
#2  0x00000008009c211a in pthread_mutexattr_init () from /lib/libpthread.so.2
#3  0x0000000000000000 in ?? ()
Run Code Online (Sandbox Code Playgroud)

该程序已经与标准信号11一起崩溃,分段故障.我的应用程序是一个在FreeBSD 6.3上运行的多线程FastCGI C++程序,使用pthread作为线程库.

根据信息来源,它已使用-g编译,并且我的源的所有符号表都已加载.

很明显,我的实际代码都没有出现在跟踪中,而是错误似乎来自标准的pthread库.特别是什么?()????

编辑:最终在我的主代码中跟踪崩溃到标准的无效内存访问.不解释为什么堆栈跟踪已损坏,但这是另一天的问题:)

c++ gdb freebsd fastcgi pthreads

14
推荐指数
2
解决办法
1万
查看次数

Linux chroot监狱和FreeBSD监狱有什么区别?

Linux chroot监狱和FreeBSD监狱有什么区别?它们是现代系统中的同义词吗?一个比另一个更安全吗?一个人更灵活吗?

linux freebsd jail

14
推荐指数
1
解决办法
5283
查看次数

mktime和tm_isdst

我在这里想到了很多不同的看法.

我看了man mktime:

 (A positive or zero value for tm_isdst causes mktime() to presume initially
 that summer time (for example, Daylight Saving Time) is or is not in
 effect for the specified time, respectively.  A negative value for
 tm_isdst causes the mktime() function to attempt to divine whether summer
 time is in effect for the specified time. 
Run Code Online (Sandbox Code Playgroud)

我的问题是,不tm_isdst应该-1让系统决定它的dst是否与代码成为dst不可知的那样?

我错过了什么吗?

c unix time freebsd mktime

14
推荐指数
2
解决办法
3万
查看次数

内存不足错误后,PHP会自动添加错误

这可能更适合服务器故障,但我想我先问这里.

我们的服务器上的每个PHP文件都有一个文件,它使用auto-prepend,它包含一个Bootstrap我们用于自动加载,环境检测等的类.它一切正常.

但是,当在同一服务器上的另一个文件的请求之前(即,小于一秒或甚至同时)存在"OUT OF MEMORY"错误时,会发生以下三种情况之一:

  1. 我们用于检查的代码(if(class_exists('Bootstrap')我们在第一次遇到此错误时用于包装类定义)返回true,这意味着该类已经被声明,尽管这是自动前置文件.

  2. 我们从自动预装文件中得到"无法重新声明类Bootstrap"错误,这意味着class_exists('Bootstrap')返回false但仍以某种方式仍然声明了.

  3. 该文件根本没有预先设置,导致依赖于它的文件出现一次性致命错误.

当然,我们可以尝试修复内存不足问题,因为这些问题似乎导致了其他错误,但由于各种原因,它们在我们的设置中无法修复或者很难修复.但这不是重点 - 在我看来,这是PHP中的一个错误,某种内存泄漏会导致auto-prepend指令出现问题.

这比任何事情都更好奇,因为这很少发生(可能每周一次在我们的高流量服务器上).但我想知道 - 为什么会发生这种情况,我们可以采取哪些措施来解决这个问题?

我们正在运行FreeBSD 9.2使用PHP 5.4.19.

编辑:我们在过去几个月试图解决这个问题时注意到的一些事情:

  • 它似乎只发生在我们的安全服务器上.内存不足问题主要出现在我们的安全服务器上(他们通常是我们自己的员工试图下载过多的数据),所以这可能只是巧合,但值得指出

  • get_declared_classes我们遇到此问题时的转储包含未在触发错误的页面上使用的类.例如,该$_SERVER人的输出在xyz.com上,但其中一个声明的类仅用于abc.com,这是内存不足问题通常源自的地方.

  • 所有这一切使我相信PHP在获得内存不足错误后没有进行正确的循环结束垃圾收集,这导致Bootstrap类在下一页请求中完全或部分在内存中,如果它很快就会错误.我不熟悉PHP垃圾收集实际上对此采取行动,但我认为这很可能是问题所在.

php garbage-collection freebsd out-of-memory

14
推荐指数
1
解决办法
605
查看次数

如何在应用程序中使用四核CPU

对于使用四核处理器的所有内核,我需要在代码中进行更改,即添加对多线程的支持,还是由操作系统自身处理.我有FreeBSD,我使用的语言是C++.我想给我的应用程序提供至少90%的完整CPU周期.

c++ programming-languages freebsd

13
推荐指数
3
解决办法
2万
查看次数

以root身份执行Python脚本(seteuid vs c-wrapper)

我在python脚本中有一个快速的一次性任务,我想从Django(www用户)调用,这将需要root权限.

起初我以为我可以使用Python的os.seteuid()并在脚本上设置setuid位,但后来我意识到我必须在Python本身上设置setuid位,我认为这是大不了.据我所知,如果使用sudo,情况也是如此,我真的很想避免.

在这一点上,我正在考虑编写一个C包装器使用seteuid并以root身份调用我的python脚本,并将必要的参数传递给它.

这是正确的做法还是我应该看别的东西?

c python django freebsd

13
推荐指数
1
解决办法
4588
查看次数

如何在FreeBSD中默认设置Python版本?

我正在尝试安装应用程序节点,但默认情况下我的环境是python 3,并且需要python 2.6.如何在FreeBSD中更改默认的python版本?

# cd /usr/local/bin
# ls -l | grep python
-r-xr-xr-x   2 root  wheel  1246256 Jul 12  2011 python
-r-xr-xr-x   2 root  wheel     1401 Jul 12  2011 python-config
-r-xr-xr-x   2 root  wheel     6060 Jul 12  2011 python-shared
-r-xr-xr-x   2 root  wheel     1408 Jul 12  2011 python-shared-config
-r-xr-xr-x   1 root  wheel     3720 Jul 12  2011 python-shared2.6
-r-xr-xr-x   1 root  wheel     1431 Jul 12  2011 python-shared2.6-config
-r-xr-xr-x   2 root  wheel …
Run Code Online (Sandbox Code Playgroud)

python freebsd environment-variables

13
推荐指数
2
解决办法
2万
查看次数

emacs错误'ls不支持--dired'

自从升级到emacs 24.x我每次打开目录时都看到了这个错误.整个错误是:

ls does not support --dired; see `dired-use-ls-dired' for more details.
Run Code Online (Sandbox Code Playgroud)

查看变量,可以发现:

dired-use-ls-dired is a variable defined in `dired.el'.
Its value is nil
Original value was unspecified

Documentation:
Non-nil means Dired should pass the "--dired" option to "ls".
The special value of `unspecified' means to check explicitly, and
save the result in this variable.  This is performed the first
time `dired-insert-directory' is called.

Note that if you set this option to nil, either through choice or
because …
Run Code Online (Sandbox Code Playgroud)

emacs freebsd emacs24

13
推荐指数
3
解决办法
3968
查看次数

Elixir Phoenix生产服务器存在Letsencrypt续订问题

我有一个用Elixir Phoenix框架工作的网站.该网站在开发和生产模式下运行良好.

当凤凰服务器在开发模式下运行,我没有问题renewingLet的加密证书,但是当完全相同的应用程序在PROD模式下运行,我不断尝试续订时,得到允许误差.请注意,我正在谈论完全相同的应用程序,在同一个 FreeBSD服务器上,由同一个用户执行- 两个命令都没有sudo.该唯一的区别是MIX_ENV=prod

我还注意到在prod模式下,凤凰服务器在Letsencrypt尝试访问我的priv/static/.well-known/acme-challenge/(some-unique-string)基本设置为phoenix + letsencrypt 时记录404错误在此博客文章中有详细说明

问题是:phoenix服务器如何在`prod'和'dev'模式之间区别对待目录/文件权限?

  • 使用Elixir 1.2.4和Phoenix 1.1.4

更新:

伙计们,因为LetsEncrypt和凤凰框架迅速发展,我上面列出的问题已不再是一个问题,如果你正在使用从LetsEncrypt和凤凰1.2.0最新cerbot

但这不是原始问题的答案.

freebsd elixir web-deployment phoenix-framework lets-encrypt

13
推荐指数
1
解决办法
1047
查看次数

sctp_connectx()在FreeBSD上给出了EINVAL

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/sctp.h>
#include <stdio.h>
#include <string.h>

int main(int argc,char **argv)
{

    struct sockaddr_in remoteAddr;

    int clientSock = socket(PF_INET,SOCK_SEQPACKET,IPPROTO_SCTP);
    if(clientSock == -1) {
        perror("socket");
        return 1;
    }
    memset(&remoteAddr,0,sizeof remoteAddr);
    remoteAddr.sin_family = AF_INET;
    remoteAddr.sin_len = sizeof remoteAddr;
    remoteAddr.sin_port = htons(5555);
    remoteAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
    sctp_assoc_t assoc_id = 0;
    if(sctp_connectx(clientSock,(struct sockaddr*)&remoteAddr,1, &assoc_id)!= 0) {
        perror("sctp_connectx");
        return 1;
    }
    printf("Connected! Assoc ID %d\n",(int)assoc_id);

    return 0;   
}
Run Code Online (Sandbox Code Playgroud)

运行时,此代码失败:

$ clang  -Wall sctp_connect.c 
$ ./a.out 
sctp_connectx: Invalid argument
$ uname -rp …
Run Code Online (Sandbox Code Playgroud)

c freebsd sctp

13
推荐指数
1
解决办法
307
查看次数