简体   繁体   English

根据后缀致命,无法发送电子邮件:无法确定打开文件的限制

[英]Unable to send email, as per postfix fatal: unable to determine open file limit

I am using java to attempt to send an email. 我正在使用Java尝试发送电子邮件。 This has worked in the recent past and no code with sending of emails has changed. 这在最近有效,并且没有更改发送电子邮件的代码。 I am currently getting the following stack trace when I try to send an email from my code: 当我尝试通过代码发送电子邮件时,当前正在获取以下堆栈跟踪:

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
  nested exception is:
    java.net.ConnectException: Connection refused
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1984)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:656)
    at javax.mail.Service.connect(Service.java:345)
    at javax.mail.Service.connect(Service.java:226)
    at javax.mail.Service.connect(Service.java:175)
    at javax.mail.Transport.send0(Transport.java:253)
    at javax.mail.Transport.send(Transport.java:124)
    at com.someMachine.email.SmtpHandlerMailer.send(SmtpHandlerMailer.java:616)
    at com.someMachine.business.doSomething(InMyCode.java:648)
    at com.someMachine.resource.someEmailResource.sendEmail(someEmailResource.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
    at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:190)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:301)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:229)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1950)
    ... 54 more

I think I've narrowed it down to postfix not launching on my machine. 我认为我已将其范围缩小到无法在计算机上启动的后缀。 As recently as a few weeks ago sending mail in this way was just fine. 就在几周前,以这种方式发送邮件还不错。

I have, starting in macOS 10.9, changed the launchctl plist configuration to have macOS keep postfix running. 从macOS 10.9开始,我更改了launchctl plist配置,以使macOS保持后缀运行。 Currently it appears to be failing to launch every 10 seconds with the following messages (via console): 当前,它似乎无法每10秒启动一次,并显示以下消息(通过控制台):

default 09:17:49.283668 -0700   master  subsystem: com.apple.network, category: , enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 2, enable_private_data: 0

default 09:17:49.284396 -0700   master  fatal: unable to determine open file limit

Manually launching it gives me the following output: 手动启动它会为我提供以下输出:

> sudo postfix start                                                                                                 postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
postfix/postfix-script: starting the Postfix mail system
postfix/postfix-script: fatal: mail system startup failed

Frustratingly, there are no log files anywhere I can find to look at on why the process isn't actually starting. 令人沮丧的是,我找不到任何日志文件可以查看为什么该进程实际上并未启动。 Presumably it's a configuration issue of some sort, but I can't seem to find anything wrong or any way to change the settings to allow postfix to launch. 大概这是某种配置问题,但我似乎找不到任何错误或任何方法来更改设置以允许发布postfix。

/etc/postfix/master.cf and /etc/postfix/main.cf config files are the default macOS ones. /etc/postfix/master.cf/etc/postfix/main.cf配置文件是默认的macOS文件。

I am using homebrew, and have considered the possibility of brew having installed something that broke postfix indirectly, but have had no success looking in that direction. 我正在使用自制软件,并考虑了brew安装间接破坏了postfix的东西的可能性,但是在该方向上没有成功。

unable to determine open file limit 无法确定打开文件的限制

As suggested in this thread , the error could be related to incompatibility with your macOS kernel 如该线程中所建议,该错误可能与您的macOS内核不兼容有关

This appears to be because postfix calls getrlimit in a way that it incompatible with the macOS kernel or system library API, perhaps involving comparison with RLIM_INFINITY . 这似乎是因为后缀以与macOS内核或系统库API不兼容的方式调用getrlimit ,可能涉及与RLIM_INFINITY比较。

I believe this should be reported as a bug to Apple support, so they can fix it on their side. 我相信应该将此报告为Apple支持的错误,因此他们可以自己解决此问题。

Check similar bug in Debian . 检查Debian中的类似错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM