buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51287, lwip_netconn_do_gethostbyname -...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #51287: lwip_netconn_do_gethostbyname - signal mutex before end.

Submitter:  Boberek <bober>
Submitted:  Wed 21 Jun 2017 05:07:26 PM UTC
   
 
Category:  DNS Severity:  3 - Normal
Item Group:  None Status:  Duplicate
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.0.2

Thu 22 Jun 2017 12:06:07 PM UTC, comment #4: 

Duplicate from bug #46887

Dirk Ziegelmeier <dziegel>
Group administrator
Thu 22 Jun 2017 11:50:28 AM UTC, comment #3: 

It's my mistake.
I wrote bad version.
My version is not 2.02.
My version is dc36dbac27131cd5a2238e2ae5a583b889f41302
So.
Everything is now OK.
Bug not exist now.
bug should be closed


Boberek <bober>
Wed 21 Jun 2017 08:41:18 PM UTC, comment #2: 

This sounds strangely familiar to bug #46887.  From that bug report it sounds like lwip_netconn_do_dns_found is not supposed to be called synchronously from dns_gethostbyname_addrtype, is that correct?

If so, then sounds like Boberek found another instance

Joel Cunningham <jcunningham>
Group Member
Wed 21 Jun 2017 08:05:49 PM UTC, comment #1: 

So you're actually using LWIP_MPU_COMPATIBLE==1?

Simon Goldschmidt <goldsimon>
Group administrator
Wed 21 Jun 2017 05:07:26 PM UTC, original submission:  

In function lwip_netconn_do_gethostbyname we have:

API_EXPR_DEREF(msg->err) = dns_gethostbyname_addrtype(msg->name,
    API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg,

exist path in call dns_gethostbyname_addrtype with call lwip_netconn_do_dns_found()[when dhcp is just start working].


Scenario:
1. call netconn_gethostbyname(),send messege (tcpcallback) to tcp_thread and wait on semaphore for result.
2. tcp_thread call lwip_netconn_do_gethostbyname
3. lwip_netconn_do_gethostbyname call dns_gethostbyname_addrtype
4. somewhere in dns_gethostbyname_addrtype call lwip_netconn_do_dns_found.
5. lwip_netconn_do_dns_found signal semaphore.
6. In another thread netconn_gethostbyname() can continue (semaphore is signaled), function netconn_gethostbyname()is finished (address msg and err is not valid, is somewere in the stack).
7. Assign msg->err in statement:
API_EXPR_DEREF(msg->err) = dns_gethostbyname_addrtype(msg->name,
    API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg,
write somewere in memory on the stack.
8. My program crash (tcp_thread write on stack another thread).

Fast my bugfix in netconn_gethostbyname() is add:
  {
    int err1 = tcpip_callback(lwip_netconn_do_nothing, &API_VAR_REF(msg));
    if (err1 == SOK) {
      sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));
    }
  }
after:
sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));

or wait some ms after:
sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));


Boberek <bober>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by jcunningham (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by bober (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-22 dziegel StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code